diff --git a/pytest.ini b/pytest.ini index 03ca1389..52506f47 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,3 @@ [pytest] addopts = -v --tb=short -python_paths = . norecursedirs = .tox .git */migrations/* */static/* docs venv */{{cookiecutter.project_slug}}/* diff --git a/requirements.txt b/requirements.txt index c878932c..7dbf7225 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ pre-commit==2.17.0 # Testing # ------------------------------------------------------------------------------ tox==3.24.5 -pytest==6.2.5 +pytest==7.0.0 pytest-cookies==0.6.1 pytest-instafail==0.4.2 pyyaml==6.0 diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index ada1809f..fc3ecf81 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -153,10 +153,10 @@ def test_project_generation(cookies, context, context_override): result = cookies.bake(extra_context={**context, **context_override}) assert result.exit_code == 0 assert result.exception is None - assert result.project.basename == context["project_slug"] - assert result.project.isdir() + assert result.project_path.name == context["project_slug"] + assert result.project_path.is_dir() - paths = build_files_list(str(result.project)) + paths = build_files_list(str(result.project_path)) assert paths check_paths(paths) @@ -167,7 +167,7 @@ def test_flake8_passes(cookies, context_override): result = cookies.bake(extra_context=context_override) try: - sh.flake8(_cwd=str(result.project)) + sh.flake8(_cwd=str(result.project_path)) except sh.ErrorReturnCode as e: pytest.fail(e.stdout.decode()) @@ -184,7 +184,7 @@ def test_black_passes(cookies, context_override): "--exclude", "migrations", ".", - _cwd=str(result.project), + _cwd=str(result.project_path), ) except sh.ErrorReturnCode as e: pytest.fail(e.stdout.decode()) @@ -203,10 +203,10 @@ def test_travis_invokes_pytest(cookies, context, use_docker, expected_test_scrip assert result.exit_code == 0 assert result.exception is None - assert result.project.basename == context["project_slug"] - assert result.project.isdir() + assert result.project_path.name == context["project_slug"] + assert result.project_path.is_dir() - with open(f"{result.project}/.travis.yml", "r") as travis_yml: + with open(f"{result.project_path}/.travis.yml", "r") as travis_yml: try: yml = yaml.safe_load(travis_yml)["jobs"]["include"] assert yml[0]["script"] == ["flake8"] @@ -230,10 +230,10 @@ def test_gitlab_invokes_flake8_and_pytest( assert result.exit_code == 0 assert result.exception is None - assert result.project.basename == context["project_slug"] - assert result.project.isdir() + assert result.project_path.name == context["project_slug"] + assert result.project_path.is_dir() - with open(f"{result.project}/.gitlab-ci.yml", "r") as gitlab_yml: + with open(f"{result.project_path}/.gitlab-ci.yml", "r") as gitlab_yml: try: gitlab_config = yaml.safe_load(gitlab_yml) assert gitlab_config["flake8"]["script"] == ["flake8"] @@ -257,10 +257,10 @@ def test_github_invokes_linter_and_pytest( assert result.exit_code == 0 assert result.exception is None - assert result.project.basename == context["project_slug"] - assert result.project.isdir() + assert result.project_path.name == context["project_slug"] + assert result.project_path.is_dir() - with open(f"{result.project}/.github/workflows/ci.yml", "r") as github_yml: + with open(f"{result.project_path}/.github/workflows/ci.yml", "r") as github_yml: try: github_config = yaml.safe_load(github_yml) linter_present = False @@ -311,6 +311,6 @@ def test_pycharm_docs_removed(cookies, context, use_pycharm, pycharm_docs_exist) context.update({"use_pycharm": use_pycharm}) result = cookies.bake(extra_context=context) - with open(f"{result.project}/docs/index.rst", "r") as f: + with open(f"{result.project_path}/docs/index.rst", "r") as f: has_pycharm_docs = "pycharm/configuration" in f.read() assert has_pycharm_docs is pycharm_docs_exist diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index deb7e0bd..3c0d7264 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -15,7 +15,7 @@ watchgod==0.7 # https://github.com/samuelcolvin/watchgod # ------------------------------------------------------------------------------ mypy==0.931 # https://github.com/python/mypy django-stubs==1.9.0 # https://github.com/typeddjango/django-stubs -pytest==6.2.5 # https://github.com/pytest-dev/pytest +pytest==7.0.0 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.4 # https://github.com/Frozenball/pytest-sugar {%- if cookiecutter.use_drf == "y" %} djangorestframework-stubs==1.4.0 # https://github.com/typeddjango/djangorestframework-stubs