Skip to content

Commit

Permalink
test: 'make upgrade' always
Browse files Browse the repository at this point in the history
  • Loading branch information
Ned Batchelder authored and nedbat committed Aug 4, 2023
1 parent cb4a28d commit 0bc4df6
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
BACKEND_SERVICE_EDX_OAUTH2_SECRET = os.environ.get(
'BACKEND_SERVICE_EDX_OAUTH2_SECRET',
'{{cookiecutter.project_name}}-backend-service-secret'
) # noqa: E501
)

JWT_AUTH.update({
'JWT_SECRET_KEY': 'lms-secret',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

-r base.txt # Core dependencies for this package

pytest
pytest-cov # pytest extension for code coverage statistics
8 changes: 3 additions & 5 deletions tests/test_cookiecutter_django_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def fixture_options_baked(cookies_session, request, custom_template):
baked result.
"""
with bake_in_temp_dir(cookies_session, extra_context=request.param, template=custom_template):
sh.make('upgrade')
sh.pip('install', '-r', 'requirements/test.txt')

yield request.param


Expand Down Expand Up @@ -146,11 +149,6 @@ def test_setup_py(options_baked):
assert " author_email='cookie@monster.org'," in setup_text


def test_upgrade(options_baked):
"""Make sure the upgrade target works"""
run_in_virtualenv('make upgrade')


def test_quality(options_baked):
"""Run quality tests on the given generated output."""
py_files = [name for name in all_files() if name.endswith(".py")]
Expand Down
13 changes: 4 additions & 9 deletions tests/test_cookiecutter_django_ida.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from .bake import bake_in_temp_dir
from .common_tests import * # pylint: disable=wildcard-import
from .venv import all_files, run_in_virtualenv
from .venv import all_files

LOGGING_CONFIG = {
'version': 1,
Expand Down Expand Up @@ -59,6 +59,9 @@ def fixture_options_baked(cookies_session, request, custom_template):
baked result.
"""
with bake_in_temp_dir(cookies_session, extra_context=request.param, template=custom_template):
sh.make('upgrade')
sh.pip('install', '-r', 'requirements/test.txt')

yield request.param


Expand Down Expand Up @@ -88,16 +91,8 @@ def test_github_actions_ci(options_baked):
assert 'pip install -r requirements/ci.txt' in ci_text


def test_upgrade(options_baked):
"""Make sure the upgrade target works"""
run_in_virtualenv('make upgrade')


def test_quality(options_baked):
"""Run quality tests on the given generated output."""
sh.make('upgrade')
sh.pip('install', '-r', 'requirements/test.txt')

py_files = [name for name in all_files() if name.endswith(".py")]
sh.pylint(*py_files)
sh.pycodestyle(*py_files)
Expand Down
7 changes: 4 additions & 3 deletions tests/test_cookiecutter_python_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def fixture_options_baked(cookies_session, request, custom_template):
baked result.
"""
with bake_in_temp_dir(cookies_session, extra_context=request.param, template=custom_template):
sh.make('upgrade')
sh.pip('install', '-r', 'requirements/test.txt')

yield request.param


Expand Down Expand Up @@ -109,7 +112,5 @@ def test_setup_py(options_baked):
def test_tests_and_quality(options_baked):
"""
Run generated tests and quality checks.
This also tests `make upgrade` by necessity, since it needs the requirements files.
"""
run_in_virtualenv('make upgrade requirements test-all')
run_in_virtualenv('make requirements test-all')
12 changes: 3 additions & 9 deletions tests/test_cookiecutter_xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from .bake import bake_in_temp_dir
from .common_tests import * # pylint: disable=wildcard-import
from .venv import all_files, run_in_virtualenv
from .venv import all_files

LOGGING_CONFIG = {
'version': 1,
Expand Down Expand Up @@ -60,6 +60,8 @@ def fixture_options_baked(cookies_session, request, custom_template):
baked result.
"""
with bake_in_temp_dir(cookies_session, extra_context=request.param, template=custom_template):
sh.make('upgrade')
sh.pip('install', '-r', 'requirements/test.txt')
yield request.param


Expand Down Expand Up @@ -100,16 +102,8 @@ def test_setup_py(options_baked):
assert " author_email='cookie@monster.org'," in setup_text


def test_upgrade(options_baked):
"""Make sure the upgrade target works"""
run_in_virtualenv('make upgrade')


def test_quality(options_baked):
"""Run quality tests on the given generated output."""
sh.make('upgrade')
sh.pip('install', '-r', 'requirements/base.txt')

py_files = [name for name in all_files() if name.endswith(".py")]
sh.pylint(*py_files)
sh.pycodestyle(*py_files)
Expand Down

0 comments on commit 0bc4df6

Please sign in to comment.