Skip to content

Commit

Permalink
Use tmp_path and jaraco.path.build to build files.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 24, 2022
1 parent 457df38 commit a361461
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions distutils/tests/test_dist.py
Expand Up @@ -8,6 +8,7 @@
import unittest.mock as mock

import pytest
import jaraco.path

from distutils.dist import Distribution, fix_help_options
from distutils.cmd import Command
Expand Down Expand Up @@ -492,22 +493,14 @@ def test_custom_pydistutils(self):
finally:
os.remove(user_filename)

def test_extra_pydistutils(self, monkeypatch):
# make sure pydistutils.cfg is found
extra_filename = "overrides.cfg"

temp_dir = self.mkdtemp()
extra_filename = os.path.join(temp_dir, extra_filename)
with open(extra_filename, 'w') as f:
f.write('.')
def test_extra_pydistutils(self, monkeypatch, tmp_path):
jaraco.path.build({'overrides.cfg': '.'}, tmp_path)
filename = tmp_path / 'overrides.cfg'

monkeypatch.setenv('DISTUTILS_EXTRA_CONFIG', extra_filename)
try:
dist = Distribution()
files = dist.find_config_files()
assert extra_filename in files
finally:
os.remove(extra_filename)
monkeypatch.setenv('DISTUTILS_EXTRA_CONFIG', filename)
dist = Distribution()
files = dist.find_config_files()
assert str(filename) in files

def test_fix_help_options(self):
help_tuples = [('a', 'b', 'c', 'd'), (1, 2, 3, 4)]
Expand Down

0 comments on commit a361461

Please sign in to comment.