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

feat: added tox_version #304

Merged
merged 1 commit into from
Nov 2, 2023
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
1 change: 1 addition & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"python_version": "3.8",
"supported_python_versions": "3.8, 3.9, 3.10, 3.11",
"poetry_version": "1.1.14",
"tox_version": "4.11.3",

"should_create_author_files": "y",
"should_install_github_dependabot": "y",
Expand Down
24 changes: 24 additions & 0 deletions tests/test_cookiecutter_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,30 @@ def test_with_poetry_version(
pytest.fail('Should have appropriate poetry version')


@pytest.mark.parametrize('tox_version', ['8.0.8', '4.2.0'])
def test_with_tox_version(
cookies: Cookies,
default_context: typing.Dict[str, str],
tox_version: str,
) -> None:
default_context['tox_version'] = tox_version
baked_project = cookies.bake(extra_context=default_context)

assert baked_project.exit_code == 0
assert baked_project.exception is None
assert baked_project.project_path.is_dir()

abs_baked_files = build_files_list(str(baked_project.project_path))

for path in abs_baked_files:
if 'ci.yml' in path:
with open(path, 'rb', 0) as file, mmap.mmap(
file.fileno(), 0, access=mmap.ACCESS_READ
) as s:
if s.find(f"tox=={tox_version}".encode()) == -1:
pytest.fail('Should have appropriate tox version')


@pytest.mark.parametrize('version', ['42.0', '4.2.0'])
def test_with_version(
cookies: Cookies,
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.package_name}}/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry=={{ cookiecutter.poetry_version }} tox==4.4.5 tox-gh
python -m pip install poetry=={{ cookiecutter.poetry_version }} tox=={{ cookiecutter.tox_version }} tox-gh
- name: Cache pre-commit
uses: actions/cache@v3
with:
Expand All @@ -59,7 +59,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry=={{ cookiecutter.poetry_version }} tox==4.4.5 tox-gh
python -m pip install poetry=={{ cookiecutter.poetry_version }} tox=={{ cookiecutter.tox_version }} tox-gh
- name: Cache tox env
uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.package_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pytest-mock = "^3.1.0"
pytest-randomly = "^3.0"
pytest-xdist = "^3.2.0"
sphinx = "^6.1.3"
tox = "^4.4.6"
tox = "^{{ cookiecutter.tox_version }}"
black = "^23.1"
hypothesis = "^6.68.2"
mutmut = "^2.4.3"
Expand Down