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

Template fix: missing entry point if "argparse" and config for "nosetests" #64

Merged
merged 2 commits into from
Jul 27, 2016
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
9 changes: 9 additions & 0 deletions {{cookiecutter.repo_name}}/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ universal = 1
max-line-length = 140
exclude = tests/*,*/migrations/*,*/south_migrations/*

{% if cookiecutter.test_runner|lower == "pytest" -%}
[pytest]
norecursedirs =
.git
Expand All @@ -33,6 +34,14 @@ addopts =
--doctest-glob=\*.rst
--tb=short

{%- elif cookiecutter.test_runner|lower == "nose" -%}
[nosetests]
verbosity = 2
with-coverage = 1
cover-package = {{ cookiecutter.package_name|replace('-', '_') }}
where = tests/

{% endif -%}
[isort]
force_single_line=True
line_length=120
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _unavailable(self, e):
'cython',
] if Cython else [],
{%- endif %}
{%- if cookiecutter.command_line_interface|lower in ['plain', 'click'] %}
{%- if cookiecutter.command_line_interface|lower != 'no' %}
entry_points={
'console_scripts': [
'{{ cookiecutter.command_line_interface_bin_name }} = {{ cookiecutter.package_name|replace('-', '_') }}.cli:main',
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.repo_name}}/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ commands =
{%- endif %}
{%- else %}
{%- if cookiecutter.test_matrix_separate_coverage|lower == 'yes' %}
nocov: {posargs:nosetests -v tests}
nocov: {posargs:nosetests -v}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs not be removed: it would collect the code in the src dir while normally it's imported from site-packages. That would lead to many subtle issues(like doubly executed module, reference issues, collection errors etc).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... on second thought, does the [nosetests]where in setup.cfg always apply?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fact nosetes read the setup.cfg if it is started in the project's directory.
See: http://nose.readthedocs.io/en/latest/usage.html#configuration
Is the current working directory set during tox task?

Copy link
Owner

@ionelmc ionelmc May 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CWD isn't changed. It's fine, however, if the location is fixed in the config file then the cover envs have no chance of collecting doctests. This is why it was specified on command line. Less than ideal but test_matrix_separate_coverage is not for everyone either :)

cover: {posargs:nosetests --with-coverage --cover-package={{ cookiecutter.package_name|replace('-', '_') }}}
{%- else %}
{posargs:nosetests --with-coverage --cover-package={{ cookiecutter.package_name|replace('-', '_')}} tests}
{posargs:nosetests --with-coverage --cover-package={{ cookiecutter.package_name|replace('-', '_')}}}
{%- endif %}
{%- endif %}

Expand Down