Skip to content

Commit bb48ac1

Browse files
author
Janneke van der Zwaan
committed
Replace - with _ in some places
Also added a test with a project name with a -. Refs #33
1 parent 10c8515 commit bb48ac1

File tree

6 files changed

+25
-3
lines changed

6 files changed

+25
-3
lines changed

tests/test_values.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,27 @@ def test_single_quotes_in_name_and_description(cookies):
5454
pytest.fail(e)
5555
finally:
5656
os.chdir(cwd)
57+
58+
59+
@pytest.mark.skipif(sys.platform.startswith('win'),
60+
reason='Skipping test with sh-module on Windows')
61+
def test_dash_in_project_slug(cookies):
62+
ctx = {'project_slug': "my-package"}
63+
project = cookies.bake(extra_context=ctx)
64+
65+
assert project.exit_code == 0
66+
67+
with open(os.path.join(str(project.project), 'setup.py')) as f:
68+
setup = f.read()
69+
print(setup)
70+
71+
cwd = os.getcwd()
72+
os.chdir(str(project.project))
73+
74+
try:
75+
sh.python(['setup.py', 'install'])
76+
sh.python(['setup.py', 'build_sphinx'])
77+
except sh.ErrorReturnCode as e:
78+
pytest.fail(e)
79+
finally:
80+
os.chdir(cwd)

{{cookiecutter.project_slug}}/setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# To update the package version number, edit {{ cookiecutter.project_slug }}/__version__.py
1010
version = {}
11-
with open(os.path.join(here, '{{ cookiecutter.project_slug }}', '__version__.py')) as f:
11+
with open(os.path.join(here, '{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_') }}', '__version__.py')) as f:
1212
exec(f.read(), version)
1313

1414
with open('README.rst') as readme_file:
@@ -33,8 +33,6 @@
3333
packages=[
3434
'{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}',
3535
],
36-
package_dir={'{{ cookiecutter.project_slug }}':
37-
'{{ cookiecutter.project_slug }}'},
3836
include_package_data=True,
3937
{%- if cookiecutter.open_source_license in license_classifiers %}
4038
license="{{ cookiecutter.open_source_license }}",

{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__init__.py renamed to {{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/__init__.py

File renamed without changes.

{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__version__.py renamed to {{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/__version__.py

File renamed without changes.

{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py renamed to {{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py

File renamed without changes.

{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}.py renamed to {{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/{{cookiecutter.project_slug}}.py

File renamed without changes.

0 commit comments

Comments
 (0)