test_bdist_egg.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """develop tests
  2. """
  3. import os
  4. import re
  5. import pytest
  6. from setuptools.dist import Distribution
  7. from . import contexts
  8. SETUP_PY = """\
  9. from setuptools import setup
  10. setup(name='foo', py_modules=['hi'])
  11. """
  12. @pytest.yield_fixture
  13. def setup_context(tmpdir):
  14. with (tmpdir/'setup.py').open('w') as f:
  15. f.write(SETUP_PY)
  16. with (tmpdir/'hi.py').open('w') as f:
  17. f.write('1\n')
  18. with tmpdir.as_cwd():
  19. yield tmpdir
  20. class Test:
  21. def test_bdist_egg(self, setup_context, user_override):
  22. dist = Distribution(dict(
  23. script_name='setup.py',
  24. script_args=['bdist_egg'],
  25. name='foo',
  26. py_modules=['hi']
  27. ))
  28. os.makedirs(os.path.join('build', 'src'))
  29. with contexts.quiet():
  30. dist.parse_command_line()
  31. dist.run_commands()
  32. # let's see if we got our egg link at the right place
  33. [content] = os.listdir('dist')
  34. assert re.match('foo-0.0.0-py[23].\d.egg$', content)