Skip to content

Commit

Permalink
Use jaraco.path.build in test_tests_are_run_once.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Nov 26, 2021
1 parent dd5a2ce commit a8e9cc8
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions setuptools/tests/test_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os

import pytest
from jaraco import path

from setuptools.command.test import test
from setuptools.dist import Distribution
Expand Down Expand Up @@ -80,25 +81,24 @@ def test_tests_are_run_once(capfd):
name='foo',
packages=['dummy'],
)
with open('setup.py', 'wt') as f:
f.write('from setuptools import setup; setup(\n')
for k, v in sorted(params.items()):
f.write(' %s=%r,\n' % (k, v))
f.write(')\n')
os.makedirs('dummy')
with open('dummy/__init__.py', 'wt'):
pass
with open('dummy/test_dummy.py', 'wt') as f:
f.write(
DALS(
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')
"""
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)
Expand Down

0 comments on commit a8e9cc8

Please sign in to comment.