Skip to content

Commit

Permalink
FIX: Use conftest.py instead of __version__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWilhelm committed May 18, 2015
1 parent 9bd24e0 commit d70a071
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Version 2.2, 2015-??-??
- Allow recursive inclusion of data files in setup.cfg, issue #49
- Replaced hand-written PyTest runner by `pytest-runner <https://pypi.python.org/pypi/pytest-runner>`_, issue #47
- Improved default README.rst, issue #51
- Use tests/conftes.py instead of tests/__init__.py, issue #52

Version 2.1, 2015-04-16
=======================
Expand Down
12 changes: 12 additions & 0 deletions pyscaffold/data/conftest_py.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Dummy conftest.py for ${package}.
If you don't know what this is for, just leave it empty.
Read more about conftest.py under:
https://pytest.org/latest/plugins.html
"""
from __future__ import print_function, absolute_import, division

import pytest
5 changes: 3 additions & 2 deletions pyscaffold/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def make_structure(args):
args.package: {"__init__.py": templates.init(args),
"skeleton.py": templates.skeleton(args),
"_version.py": templates.version(args)},
"tests": {"conftest.py": ""},
"tests": {"conftest.py": templates.conftest_py(args)},
"docs": {"conf.py": templates.sphinx_conf(args),
"authors.rst": templates.sphinx_authors(args),
"index.rst": templates.sphinx_index(args),
Expand Down Expand Up @@ -131,7 +131,8 @@ def make_structure(args):
"tox.ini": None,
args.package: {"__init__.py": None,
"skeleton.py": None},
"tests": {"travis_install.sh": None},
"tests": {"conftest.py": None,
"travis_install.sh": None},
"docs": {"index.rst": None}
}}
safe = check_files_exist(safe)
Expand Down
11 changes: 11 additions & 0 deletions pyscaffold/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,14 @@ def changes(args):
"""
template = get_template("changes")
return template.substitute(vars(args))


def conftest_py(args):
"""
Template of conftest.py
:param args: command line parameters as :obj:`argparse.Namespace`
:return: file content as string
"""
template = get_template("conftest_py")
return template.substitute(vars(args))

0 comments on commit d70a071

Please sign in to comment.