-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Removed all references to setup.py test fixes #500
#544
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
base: main
Are you sure you want to change the base?
Changes from all commits
1676453
9705c27
8c49bef
89e9a90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,7 @@ def test_bake_with_defaults(cookies): | |
| def test_bake_and_run_tests(cookies): | ||
| with bake_in_temp_dir(cookies) as result: | ||
| assert result.project.isdir() | ||
| run_inside_dir('python setup.py test', str(result.project)) == 0 | ||
| run_inside_dir('python -m unittest discover', str(result.project)) == 0 | ||
| print("test_bake_and_run_tests path", str(result.project)) | ||
|
|
||
|
|
||
|
|
@@ -98,7 +98,7 @@ def test_bake_withspecialchars_and_run_tests(cookies): | |
| extra_context={'full_name': 'name "quote" name'} | ||
| ) as result: | ||
| assert result.project.isdir() | ||
| run_inside_dir('python setup.py test', str(result.project)) == 0 | ||
| run_inside_dir('python setup.py --help', str(result.project)) == 0 | ||
|
|
||
|
|
||
| def test_bake_with_apostrophe_and_run_tests(cookies): | ||
|
|
@@ -108,7 +108,7 @@ def test_bake_with_apostrophe_and_run_tests(cookies): | |
| extra_context={'full_name': "O'connor"} | ||
| ) as result: | ||
| assert result.project.isdir() | ||
| run_inside_dir('python setup.py test', str(result.project)) == 0 | ||
| run_inside_dir('python setup.py --help', str(result.project)) == 0 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't do what the test name says
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see previous comments |
||
|
|
||
|
|
||
| # def test_bake_and_run_travis_pypi_setup(cookies): | ||
|
|
@@ -220,12 +220,10 @@ def test_using_pytest(cookies): | |
| lines = test_file_path.readlines() | ||
| assert "import pytest" in ''.join(lines) | ||
| # Test the new pytest target | ||
| run_inside_dir('python setup.py pytest', str(result.project)) == 0 | ||
| # Test the test alias (which invokes pytest) | ||
| run_inside_dir('python setup.py test', str(result.project)) == 0 | ||
| run_inside_dir('python -m pytest ./tests', str(result.project)) == 0 | ||
|
|
||
|
|
||
| def test_not_using_pytest(cookies): | ||
| def test_using_unittest(cookies): | ||
| with bake_in_temp_dir(cookies) as result: | ||
| assert result.project.isdir() | ||
| test_file_path = result.project.join( | ||
|
|
@@ -234,6 +232,8 @@ def test_not_using_pytest(cookies): | |
| lines = test_file_path.readlines() | ||
| assert "import unittest" in ''.join(lines) | ||
| assert "import pytest" not in ''.join(lines) | ||
| # Run tests using unittest | ||
| run_inside_dir('python -m unittest discover', str(result.project)) == 0 | ||
|
|
||
|
|
||
| # def test_project_with_hyphen_in_module_name(cookies): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,10 +19,3 @@ exclude = docs | |
|
|
||
| [aliases] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd remove this section if it's empty
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left this in to demonstrate how it's done, but I can certainly remove it |
||
| # Define setup.py command aliases here | ||
| {%- if cookiecutter.use_pytest == 'y' %} | ||
| test = pytest | ||
|
|
||
| [tool:pytest] | ||
| collect_ignore = ['setup.py'] | ||
| {%- endif %} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,15 +16,15 @@ commands = flake8 {{ cookiecutter.project_slug }} tests | |
| [testenv] | ||
| setenv = | ||
| PYTHONPATH = {toxinidir} | ||
| {% if cookiecutter.use_pytest == 'y' -%} | ||
| deps = | ||
| -r{toxinidir}/requirements_dev.txt | ||
| ; If you want to make tox run the tests with the same versions, create a | ||
| ; requirements.txt with the pinned versions and uncomment the following line: | ||
| ; -r{toxinidir}/requirements.txt | ||
| {% if cookiecutter.use_pytest == 'y' -%} | ||
| commands = | ||
| pip install -U pip | ||
| pytest --basetemp={envtmpdir} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Above, the command was
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved this down because requirements_dev.txt needs to be installed irrespective of which test suite is in use. Edit: I think I'm confused... does L28 need to be changed? I didn't understand the intent of this line but left it unchanged since it was not impacted by the change |
||
| {% else %} | ||
| commands = python setup.py test | ||
| commands = python -m unittest discover | ||
| {%- endif %} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't do what the test name says
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right... When I saw the docstring I rationalized that the only reason it was running the tests was to validate that setup.py was formatted correctly. Do you agree/does this accomplish the same objective with less overhead? If so I'll rename it, if not I'll change it to run tests.