diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2017-11-09 20:24:08 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-09 20:24:08 -0500 |
| commit | 26cbce17dfb5aa9ea1ffae5d25363ad645bf6e44 (patch) | |
| tree | 31214b121a85092b65f971f6b3217ecb3c8784cb /setuptools/tests/test_bdist_egg.py | |
| parent | ff9bc4902f32c331d917e8bae9136607e48c2738 (diff) | |
| parent | 4216b5f3fece69e3b74c646f72b8fe757b658729 (diff) | |
| download | python-setuptools-git-26cbce17dfb5aa9ea1ffae5d25363ad645bf6e44.tar.gz | |
Merge pull request #1145 from haobibo/master
python 3 bdist_egg --exclude-source-files __pycache__ issue
Diffstat (limited to 'setuptools/tests/test_bdist_egg.py')
| -rw-r--r-- | setuptools/tests/test_bdist_egg.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py index d24aa366..61615b38 100644 --- a/setuptools/tests/test_bdist_egg.py +++ b/setuptools/tests/test_bdist_egg.py @@ -2,6 +2,7 @@ """ import os import re +import zipfile import pytest @@ -16,7 +17,7 @@ setup(name='foo', py_modules=['hi']) """ -@pytest.yield_fixture +@pytest.fixture(scope='function') def setup_context(tmpdir): with (tmpdir / 'setup.py').open('w') as f: f.write(SETUP_PY) @@ -32,7 +33,7 @@ class Test: script_name='setup.py', script_args=['bdist_egg'], name='foo', - py_modules=['hi'] + py_modules=['hi'], )) os.makedirs(os.path.join('build', 'src')) with contexts.quiet(): @@ -42,3 +43,20 @@ class Test: # let's see if we got our egg link at the right place [content] = os.listdir('dist') assert re.match(r'foo-0.0.0-py[23].\d.egg$', content) + + def test_exclude_source_files(self, setup_context, user_override): + dist = Distribution(dict( + script_name='setup.py', + script_args=['bdist_egg', '--exclude-source-files'], + name='foo', + py_modules=['hi'], + )) + with contexts.quiet(): + dist.parse_command_line() + dist.run_commands() + [dist_name] = os.listdir('dist') + dist_filename = os.path.join('dist', dist_name) + zip = zipfile.ZipFile(dist_filename) + names = list(zi.filename for zi in zip.filelist) + assert 'hi.pyc' in names + assert 'hi.py' not in names |
