Skip to content

Commit

Permalink
Refactor into src directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jun 11, 2023
1 parent e56fbbf commit 80a54f6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,11 @@ Changelog = "https://github.com/hugovk/em-keyboard/releases"
Homepage = "https://github.com/hugovk/em-keyboard"
Source = "https://github.com/hugovk/em-keyboard"
[project.scripts]
em = "em:cli"
em = "em_keyboard:cli"

[tool.hatch]
version.source = "vcs"

[tool.hatch.build.force-include]
"em/emojis.json" = "em/emojis.json"

[tool.hatch.version.raw-options]
local_scheme = "no-local-version"

Expand Down
6 changes: 3 additions & 3 deletions scripts/despacify.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

import json

from em import parse_emojis
from em_keyboard import parse_emojis

INPUT_EMOJILIB_PATH = "em/emoji-en-US.json"
OUTPUT_EMOJI_PATH = "em/emojis.json"
INPUT_EMOJILIB_PATH = "src/em_keyboard/emoji-en-US.json"
OUTPUT_EMOJI_PATH = "src/em_keyboard/emojis.json"


def save_emojis(data: dict[str, list[str]], filename: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-emojilib.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
wget https://github.com/muan/emojilib/raw/main/dist/emoji-en-US.json -O ./em/emoji-en-US.json
wget https://github.com/muan/emojilib/raw/main/dist/emoji-en-US.json -O src/em_keyboard/emoji-en-US.json
python3 scripts/despacify.py
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion em/emojis.json → src/em_keyboard/emojis.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions tests/test_em.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest

from em import cli, copier
from em_keyboard import cli, copier


@pytest.mark.parametrize(
Expand All @@ -16,7 +16,7 @@
":Star:",
],
)
@patch("em.argparse.ArgumentParser.parse_args")
@patch("em_keyboard.argparse.ArgumentParser.parse_args")
@patch("builtins.print")
def test_star(mock_print, mock_argparse, test_name):
# Arrange
Expand All @@ -37,7 +37,7 @@ def test_star(mock_print, mock_argparse, test_name):
assert e.value.code == 0


@patch("em.argparse.ArgumentParser.parse_args")
@patch("em_keyboard.argparse.ArgumentParser.parse_args")
@patch("builtins.print")
def test_not_found(mock_print, mock_argparse):
# Arrange
Expand All @@ -54,7 +54,7 @@ def test_not_found(mock_print, mock_argparse):
assert e.value.code == 1


@patch("em.argparse.ArgumentParser.parse_args")
@patch("em_keyboard.argparse.ArgumentParser.parse_args")
@patch("builtins.print")
def test_no_copy(mock_print, mock_argparse):
# Arrange
Expand All @@ -72,7 +72,7 @@ def test_no_copy(mock_print, mock_argparse):
assert e.value.code == 0


@patch("em.argparse.ArgumentParser.parse_args")
@patch("em_keyboard.argparse.ArgumentParser.parse_args")
@patch("builtins.print")
def test_search_star(mock_print, mock_argparse):
# Arrange
Expand All @@ -96,7 +96,7 @@ def test_search_star(mock_print, mock_argparse):
assert e.value.code == 0


@patch("em.argparse.ArgumentParser.parse_args")
@patch("em_keyboard.argparse.ArgumentParser.parse_args")
@patch("builtins.print")
def test_search_single_result_is_copied(mock_print, mock_argparse):
# Arrange
Expand All @@ -117,7 +117,7 @@ def test_search_single_result_is_copied(mock_print, mock_argparse):
assert e.value.code == 0


@patch("em.argparse.ArgumentParser.parse_args")
@patch("em_keyboard.argparse.ArgumentParser.parse_args")
@patch("builtins.print")
def test_search_not_found(mock_print, mock_argparse):
# Arrange
Expand All @@ -135,7 +135,7 @@ def test_search_not_found(mock_print, mock_argparse):
assert e.value.code == 1


@patch("em.argparse.ArgumentParser.parse_args")
@patch("em_keyboard.argparse.ArgumentParser.parse_args")
@patch("builtins.print")
def test_random(mock_print, mock_argparse):
# Arrange
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env_list =
extras =
tests
commands =
{envpython} -m pytest --cov em --cov tests --cov-report html --cov-report term --cov-report xml {posargs}
{envpython} -m pytest --cov em_keyboard --cov tests --cov-report html --cov-report term --cov-report xml {posargs}

[testenv:cli]
commands =
Expand Down

0 comments on commit 80a54f6

Please sign in to comment.