Skip to content

Commit

Permalink
Add copilot extension & improve test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
lukin0110 committed Jan 12, 2024
1 parent af8aa71 commit 171ce1b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"visualstudioexptteam.vscodeintellicode"
],
"settings": {
"dev.containers.copyGitConfig": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
Expand All @@ -31,8 +32,7 @@
"[toml]": {
"editor.formatOnSave": false
},
"python.defaultInterpreterPath": "/workspaces/poetry-copier/testing/.venv/bin/python",
"remote.containers.copyGitConfig": true
"python.defaultInterpreterPath": "/workspaces/poetry-copier/testing/.venv/bin/python"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# PyCharm
.idea/

# Unit test / coverage reports
reports/
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"testing"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
1 change: 1 addition & 0 deletions template/.devcontainer/devcontainer.json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"extensions": [
"charliermarsh.ruff",
"eamodio.gitlens",
"github.copilot",
"ms-azuretools.vscode-docker",
"ms-python.mypy-type-checker",
"ms-python.python",
Expand Down
5 changes: 3 additions & 2 deletions testing/tests/test_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ def test_github_generation(answers: dict[str, str | bool], expected_paths: set[s
"use_fastapi": True,
}
with TemporaryDirectory() as tmpdir:
logger.debug("GitHub package: %s", tmpdir)
copier.run_copy("../template", tmpdir, data=answers_, cleanup_on_error=True)
logger.info("GitHub package: %s", tmpdir)
_path = Path(__file__).parent.parent.parent / "template"
copier.run_copy(str(_path.absolute()), tmpdir, data=answers_, cleanup_on_error=True)
expected = expected_paths | {
".github/workflows/push_to_ghcr.yml",
".github/workflows/test.yml",
Expand Down
5 changes: 3 additions & 2 deletions testing/tests/test_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ def test_github_generation(answers: dict[str, str | bool], expected_paths: set[s
"use_gradio": True,
}
with TemporaryDirectory() as tmpdir:
logger.debug("GitHub package: %s", tmpdir)
copier.run_copy("../template", tmpdir, data=answers_, cleanup_on_error=True)
logger.info("GitHub package: %s", tmpdir)
_path = Path(__file__).parent.parent.parent / "template"
copier.run_copy(str(_path.absolute()), tmpdir, data=answers_, cleanup_on_error=True)
expected = expected_paths | {
".github/workflows/push_to_ghcr.yml",
".github/workflows/test.yml",
Expand Down
15 changes: 9 additions & 6 deletions testing/tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def test_github_generation(answers: dict[str, str | bool], expected_paths: set[s
**answers,
}
with TemporaryDirectory() as tmpdir:
logger.debug("GitHub package: %s", tmpdir)
copier.run_copy("../template", tmpdir, data=answers_, quiet=True, cleanup_on_error=True)
logger.info("GitHub package: %s", tmpdir)
_path = Path(__file__).parent.parent.parent / "template"
copier.run_copy(str(_path.absolute()), tmpdir, data=answers_, cleanup_on_error=True)
expected = expected_paths | {
".github/workflows/test.yml",
".github/dependabot.yml",
Expand All @@ -40,8 +41,9 @@ def test_gitlab_generation(answers: dict[str, str | bool], expected_paths: set[s
**answers,
}
with TemporaryDirectory() as tmpdir:
logger.debug("GitLab package: %s", tmpdir)
copier.run_copy("../template", tmpdir, data=answers_, cleanup_on_error=True)
logger.info("GitLab package: %s", tmpdir)
_path = Path(__file__).parent.parent.parent / "template"
copier.run_copy(str(_path.absolute()), tmpdir, data=answers_, cleanup_on_error=True)
expected = expected_paths | {".gitlab-ci.yml"}
assert_paths(tmpdir, expected)
assert_devcontainer(Path(tmpdir) / ".devcontainer/devcontainer.json")
Expand All @@ -58,8 +60,9 @@ def test_no_ci_generation(answers: dict[str, str | bool], expected_paths: set[st
**answers,
}
with TemporaryDirectory() as tmpdir:
logger.debug("No CI package: %s", tmpdir)
copier.run_copy("../template", tmpdir, data=answers_, cleanup_on_error=True)
logger.info("No CI package: %s", tmpdir)
_path = Path(__file__).parent.parent.parent / "template"
copier.run_copy(str(_path.absolute()), tmpdir, data=answers_, cleanup_on_error=True)
assert_paths(tmpdir, expected_paths)
assert_devcontainer(Path(tmpdir) / ".devcontainer/devcontainer.json")
assert_toml(Path(tmpdir) / "pyproject.toml")
Expand Down
1 change: 1 addition & 0 deletions testing/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def assert_devcontainer(path: Path) -> None:
"extensions": [
"charliermarsh.ruff",
"eamodio.gitlens",
"github.copilot",
"ms-azuretools.vscode-docker",
"ms-python.mypy-type-checker",
"ms-python.python",
Expand Down

0 comments on commit 171ce1b

Please sign in to comment.