blob: 530474d7a234e9eccc96ca1cbc7e768e1c54a329 (
plain)
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
|
import pytest
from jaraco import path
from setuptools.command.test import test
from setuptools.dist import Distribution
from .textwrap import DALS
@pytest.mark.usefixtures('tmpdir_cwd')
def test_tests_are_run_once(capfd):
params = dict(
packages=['dummy'],
)
files = {
'setup.py':
'from setuptools import setup; setup('
+ ','.join(f'{name}={params[name]!r}' for name in params)
+ ')',
'dummy': {
'__init__.py': '',
'test_dummy.py': DALS(
"""
import unittest
class TestTest(unittest.TestCase):
def test_test(self):
print('Foo')
"""
),
},
}
path.build(files)
dist = Distribution(params)
dist.script_name = 'setup.py'
cmd = test(dist)
cmd.ensure_finalized()
cmd.run()
out, err = capfd.readouterr()
assert out.endswith('Foo\n')
assert len(out.split('Foo')) == 2
|