Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore tests #21

Merged
merged 6 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
18 changes: 5 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@ repos:
- id: check-added-large-files
- id: check-merge-conflict

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ copier copy gh:astrojuanlu/copier-pylib path/to/destination
[pytest]: https://docs.pytest.org/
[Sphinx]: http://www.sphinx-doc.org/
[tox]: https://tox.readthedocs.io/
[black]: https://black.readthedocs.io/
[ruff]: https://beta.ruff.rs/docs/
[pre-commit]: https://github.com/pre-commit/pre-commit
[GitHub Actions]: https://github.com/features/actions
[Read the Docs]: https://readthedocs.org
[ruff]: https://docs.astral.sh/ruff/
[pre-commit]: https://github.com/pre-commit/pre-commit/
[GitHub Actions]: https://github.com/features/actions/
[Read the Docs]: https://readthedocs.org/
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mypy
pytest
pytest-cookies
pytest-copie
133 changes: 67 additions & 66 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,74 +1,75 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile
#
arrow==1.2.1
# via jinja2-time
attrs==21.2.0
# This file was autogenerated by uv v0.1.4 via the following command:
# uv pip compile requirements.in -o requirements.txt
annotated-types==0.6.0
# via pydantic
colorama==0.4.6
# via copier
copier==9.1.1
# via pytest-copie
decorator==5.1.1
# via copier
deprecated==1.2.14
# via pytest-copie
dunamai==1.19.2
# via copier
exceptiongroup==1.2.0
# via pytest
binaryornot==0.4.4
# via cookiecutter
certifi==2021.10.8
# via requests
chardet==4.0.0
# via binaryornot
charset-normalizer==2.0.9
# via requests
click==8.0.3
# via cookiecutter
cookiecutter==1.7.3
# via pytest-cookies
idna==3.3
# via requests
iniconfig==1.1.1
funcy==2.0
# via copier
iniconfig==2.0.0
# via pytest
jinja2==3.0.3
jinja2==3.1.3
# via
# cookiecutter
# jinja2-time
jinja2-time==0.2.0
# via cookiecutter
markupsafe==2.0.1
# copier
# jinja2-ansible-filters
jinja2-ansible-filters==1.3.2
# via copier
markupsafe==2.1.5
# via jinja2
mypy==0.930
# via -r requirements.in
mypy-extensions==0.4.3
mypy==1.8.0
mypy-extensions==1.0.0
# via mypy
packaging==21.3
# via pytest
pluggy==1.0.0
# via pytest
poyo==0.5.0
# via cookiecutter
py==1.11.0
packaging==23.2
# via
# copier
# dunamai
# pytest
pathspec==0.12.1
# via copier
pluggy==1.4.0
# via pytest
pyparsing==3.0.6
# via packaging
pytest==6.2.5
plumbum==1.8.2
# via copier
prompt-toolkit==3.0.36
# via questionary
pydantic==2.6.1
# via copier
pydantic-core==2.16.2
# via pydantic
pygments==2.17.2
# via copier
pytest==8.0.1
# via pytest-copie
pytest-copie==0.1.6
pyyaml==6.0.1
# via
# -r requirements.in
# pytest-cookies
pytest-cookies==0.6.1
# via -r requirements.in
python-dateutil==2.8.2
# via arrow
python-slugify==5.0.2
# via cookiecutter
requests==2.26.0
# via cookiecutter
six==1.16.0
# copier
# jinja2-ansible-filters
# pyyaml-include
pyyaml-include==1.3.2
# via copier
questionary==2.0.1
# via copier
tomli==2.0.1
# via
# cookiecutter
# python-dateutil
text-unidecode==1.3
# via python-slugify
toml==0.10.2
# via pytest
tomli==2.0.0
# via mypy
typing-extensions==4.0.1
# via mypy
urllib3==1.26.7
# via requests
# mypy
# pytest
typing-extensions==4.9.0
# via
# mypy
# pydantic
# pydantic-core
wcwidth==0.2.13
# via prompt-toolkit
wrapt==1.16.0
# via deprecated
43 changes: 21 additions & 22 deletions tests/test_bake.py → tests/test_template.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
def test_project_tree(cookies):
result = cookies.bake(
extra_context={
"github_org": "johndoe",
"project_name": "project-name",
"short_description": "Short description",
"author_name": "John Doe",
"author_email": "[email protected]",
}
)

assert result.exit_code == 0, result.exception
assert result.exception is None
assert result.project_path.name == "project-name"
assert result.project_path.is_dir()

files = [
def test_template(copie):
expected_files = [
".gitignore",
"LICENSE",
"README.md",
"pyproject.toml",
"tox.ini",
]
dirs = [
expected_dirs = [
"src",
"src/project_name",
"docs",
"docs/source",
"tests",
]

for path in files:
assert (result.project_path / path).is_file()
for path in dirs:
assert (result.project_path / path).is_dir()
result = copie.copy(
extra_answers={
"github_org": "johndoe",
"project_name": "project-name",
"short_description": "Short description",
"author_name": "John Doe",
"author_email": "[email protected]",
},
)

assert result.exit_code == 0, result.exception
assert result.exception is None
assert result.project_dir.is_dir()

for path in expected_files:
assert (result.project_dir / path).is_file()
for path in expected_dirs:
assert (result.project_dir / path).is_dir()
13 changes: 7 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
[tox]
envlist =
check
{py37,py38,py39,py310,pypy3}
{py38,py39,py310,py311,py312,pypy3}
skipsdist = True

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: check, py39
3.8: check, py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
basepython =
pypy3: pypy3
py37: python3.7
py38: python3.8
py39: python3.9
py310: python3.10
py311: python3.11
py312: python3.12
# See https://github.com/tox-dev/tox/issues/1548
{check,build}: python3
setenv =
Expand Down
Loading