File: test_bdist_egg.py

package info (click to toggle)
python-setuptools 33.1.1-1~bpo8%2B1
  • links: PTS
  • area: main
  • in suites: jessie-backports
  • size: 2,852 kB
  • sloc: python: 19,087; ansic: 195; makefile: 97; xml: 14
file content (44 lines) | stat: -rw-r--r-- 1,010 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""develop tests
"""
import os
import re

import pytest

from setuptools.dist import Distribution

from . import contexts

SETUP_PY = """\
from setuptools import setup

setup(name='foo', py_modules=['hi'])
"""


@pytest.yield_fixture
def setup_context(tmpdir):
    with (tmpdir / 'setup.py').open('w') as f:
        f.write(SETUP_PY)
    with (tmpdir / 'hi.py').open('w') as f:
        f.write('1\n')
    with tmpdir.as_cwd():
        yield tmpdir


class Test:
    def test_bdist_egg(self, setup_context, user_override):
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['bdist_egg'],
            name='foo',
            py_modules=['hi']
        ))
        os.makedirs(os.path.join('build', 'src'))
        with contexts.quiet():
            dist.parse_command_line()
            dist.run_commands()

        # let's see if we got our egg link at the right place
        [content] = os.listdir('dist')
        assert re.match('foo-0.0.0-py[23].\d.egg$', content)