mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-14 05:36:58 +03:00
Update pytest to 7.0.0 (#3567)
Co-authored-by: Bruno Alla <alla.brunoo@gmail.com>
This commit is contained in:
parent
150e1d8bed
commit
aafa66bf7c
|
@ -1,4 +1,3 @@
|
||||||
[pytest]
|
[pytest]
|
||||||
addopts = -v --tb=short
|
addopts = -v --tb=short
|
||||||
python_paths = .
|
|
||||||
norecursedirs = .tox .git */migrations/* */static/* docs venv */{{cookiecutter.project_slug}}/*
|
norecursedirs = .tox .git */migrations/* */static/* docs venv */{{cookiecutter.project_slug}}/*
|
||||||
|
|
|
@ -13,7 +13,7 @@ pre-commit==2.17.0
|
||||||
# Testing
|
# Testing
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
tox==3.24.5
|
tox==3.24.5
|
||||||
pytest==6.2.5
|
pytest==7.0.0
|
||||||
pytest-cookies==0.6.1
|
pytest-cookies==0.6.1
|
||||||
pytest-instafail==0.4.2
|
pytest-instafail==0.4.2
|
||||||
pyyaml==6.0
|
pyyaml==6.0
|
||||||
|
|
|
@ -153,10 +153,10 @@ def test_project_generation(cookies, context, context_override):
|
||||||
result = cookies.bake(extra_context={**context, **context_override})
|
result = cookies.bake(extra_context={**context, **context_override})
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert result.exception is None
|
assert result.exception is None
|
||||||
assert result.project.basename == context["project_slug"]
|
assert result.project_path.name == context["project_slug"]
|
||||||
assert result.project.isdir()
|
assert result.project_path.is_dir()
|
||||||
|
|
||||||
paths = build_files_list(str(result.project))
|
paths = build_files_list(str(result.project_path))
|
||||||
assert paths
|
assert paths
|
||||||
check_paths(paths)
|
check_paths(paths)
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ def test_flake8_passes(cookies, context_override):
|
||||||
result = cookies.bake(extra_context=context_override)
|
result = cookies.bake(extra_context=context_override)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sh.flake8(_cwd=str(result.project))
|
sh.flake8(_cwd=str(result.project_path))
|
||||||
except sh.ErrorReturnCode as e:
|
except sh.ErrorReturnCode as e:
|
||||||
pytest.fail(e.stdout.decode())
|
pytest.fail(e.stdout.decode())
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ def test_black_passes(cookies, context_override):
|
||||||
"--exclude",
|
"--exclude",
|
||||||
"migrations",
|
"migrations",
|
||||||
".",
|
".",
|
||||||
_cwd=str(result.project),
|
_cwd=str(result.project_path),
|
||||||
)
|
)
|
||||||
except sh.ErrorReturnCode as e:
|
except sh.ErrorReturnCode as e:
|
||||||
pytest.fail(e.stdout.decode())
|
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.exit_code == 0
|
||||||
assert result.exception is None
|
assert result.exception is None
|
||||||
assert result.project.basename == context["project_slug"]
|
assert result.project_path.name == context["project_slug"]
|
||||||
assert result.project.isdir()
|
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:
|
try:
|
||||||
yml = yaml.safe_load(travis_yml)["jobs"]["include"]
|
yml = yaml.safe_load(travis_yml)["jobs"]["include"]
|
||||||
assert yml[0]["script"] == ["flake8"]
|
assert yml[0]["script"] == ["flake8"]
|
||||||
|
@ -230,10 +230,10 @@ def test_gitlab_invokes_flake8_and_pytest(
|
||||||
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert result.exception is None
|
assert result.exception is None
|
||||||
assert result.project.basename == context["project_slug"]
|
assert result.project_path.name == context["project_slug"]
|
||||||
assert result.project.isdir()
|
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:
|
try:
|
||||||
gitlab_config = yaml.safe_load(gitlab_yml)
|
gitlab_config = yaml.safe_load(gitlab_yml)
|
||||||
assert gitlab_config["flake8"]["script"] == ["flake8"]
|
assert gitlab_config["flake8"]["script"] == ["flake8"]
|
||||||
|
@ -257,10 +257,10 @@ def test_github_invokes_linter_and_pytest(
|
||||||
|
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert result.exception is None
|
assert result.exception is None
|
||||||
assert result.project.basename == context["project_slug"]
|
assert result.project_path.name == context["project_slug"]
|
||||||
assert result.project.isdir()
|
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:
|
try:
|
||||||
github_config = yaml.safe_load(github_yml)
|
github_config = yaml.safe_load(github_yml)
|
||||||
linter_present = False
|
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})
|
context.update({"use_pycharm": use_pycharm})
|
||||||
result = cookies.bake(extra_context=context)
|
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()
|
has_pycharm_docs = "pycharm/configuration" in f.read()
|
||||||
assert has_pycharm_docs is pycharm_docs_exist
|
assert has_pycharm_docs is pycharm_docs_exist
|
||||||
|
|
|
@ -15,7 +15,7 @@ watchgod==0.7 # https://github.com/samuelcolvin/watchgod
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
mypy==0.931 # https://github.com/python/mypy
|
mypy==0.931 # https://github.com/python/mypy
|
||||||
django-stubs==1.9.0 # https://github.com/typeddjango/django-stubs
|
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
|
pytest-sugar==0.9.4 # https://github.com/Frozenball/pytest-sugar
|
||||||
{%- if cookiecutter.use_drf == "y" %}
|
{%- if cookiecutter.use_drf == "y" %}
|
||||||
djangorestframework-stubs==1.4.0 # https://github.com/typeddjango/djangorestframework-stubs
|
djangorestframework-stubs==1.4.0 # https://github.com/typeddjango/djangorestframework-stubs
|
||||||
|
|
Loading…
Reference in New Issue
Block a user