Skip to content

Commit a08e49c

Browse files
committed
🔬 test #131
1 parent 4be4c45 commit a08e49c

File tree

3 files changed

+38
-11
lines changed

3 files changed

+38
-11
lines changed

templates/setup.py.jj2

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,22 @@
2424
{% endif %}
2525
{% endfor %}
2626
{% block header %}
27-
# Template by pypi-mobans
27+
'''
28+
Template by pypi-mobans
29+
'''
30+
2831
{% endblock %}
32+
import os
33+
import sys
2934
import codecs
3035
import locale
31-
import os
3236
import platform
33-
import sys
3437
from shutil import rmtree
3538

3639
{% if external_module_library %}
3740
from distutils.core import setup, Extension
3841
{% else %}
39-
from setuptools import Command, find_packages, setup
42+
from setuptools import Command, setup, find_packages
4043
{%endif%}
4144
{% if marker_dependencies and setup_use_markers and setup_use_markers_fix %}
4245
from setuptools import __version__ as setuptools_version

tests/fixtures/setup.py.output

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#!/usr/bin/env python3
22

3-
# Template by pypi-mobans
3+
'''
4+
Template by pypi-mobans
5+
'''
6+
7+
import os
8+
import sys
49
import codecs
510
import locale
6-
import os
711
import platform
8-
import sys
912
from shutil import rmtree
1013

11-
from setuptools import Command, find_packages, setup
14+
from setuptools import Command, setup, find_packages
1215

1316
PY2 = sys.version_info[0] == 2
1417
PY26 = PY2 and sys.version_info[1] < 7
@@ -63,8 +66,7 @@ INSTALL_REQUIRES = [
6366
]
6467
SETUP_COMMANDS = {}
6568

66-
67-
PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"])
69+
PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests", "tests.*"])
6870
EXTRAS_REQUIRE = {}
6971
# You do not need to read beyond this line
7072
PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable)

tests/test_setup.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,29 @@ def test_setup():
1111
content = f.read()
1212
yaml = YAML(typ='safe')
1313
context = yaml.load(content)
14-
print(context)
1514
rendered = get_rendered_file(filename, context)
1615
expected = get_file_content('setup.py.output')
1716
assert expected == rendered
17+
18+
19+
def test_setup_use_markers_true():
20+
filename = 'setup.py.jj2'
21+
with open(os.path.join("tests", "fixtures", "server_use_marker_true.yml"))as f:
22+
content = f.read()
23+
yaml = YAML(typ='safe')
24+
context = yaml.load(content)
25+
rendered = get_rendered_file(filename, context)
26+
print(rendered)
27+
expected = get_file_content('setup_use_markers_true.py.output')
28+
assert expected == rendered
29+
30+
31+
def test_setup_use_markers_false():
32+
filename = 'setup.py.jj2'
33+
with open(os.path.join("tests", "fixtures", "server_use_marker_false.yml"))as f:
34+
content = f.read()
35+
yaml = YAML(typ='safe')
36+
context = yaml.load(content)
37+
rendered = get_rendered_file(filename, context)
38+
expected = get_file_content('setup_use_markers_false.py.output')
39+
assert expected == rendered

0 commit comments

Comments
 (0)