Skip to content

Commit

Permalink
Rely on tree builder in test_dir_util. Ref #232.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 2, 2024
1 parent cae489b commit b060f26
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions distutils/tests/test_dir_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import stat
import unittest.mock as mock

import jaraco.path
import path
import pytest

from distutils import dir_util, errors
from distutils.dir_util import (
mkpath,
Expand All @@ -14,7 +18,6 @@
)

from distutils.tests import support
import pytest


@pytest.fixture(autouse=True)
Expand Down Expand Up @@ -71,9 +74,8 @@ def test_copy_tree_verbosity(self, caplog):
remove_tree(self.root_target, verbose=0)

mkpath(self.target, verbose=0)
a_file = os.path.join(self.target, 'ok.txt')
with open(a_file, 'w') as f:
f.write('some content')
a_file = path.Path(self.target) / 'ok.txt'
jaraco.path.build({'ok.txt': 'some content'}, self.target)

wanted = [f'copying {a_file} -> {self.target2}']
copy_tree(self.target, self.target2, verbose=1)
Expand All @@ -85,11 +87,7 @@ def test_copy_tree_verbosity(self, caplog):
def test_copy_tree_skips_nfs_temp_files(self):
mkpath(self.target, verbose=0)

a_file = os.path.join(self.target, 'ok.txt')
nfs_file = os.path.join(self.target, '.nfs123abc')
for f in a_file, nfs_file:
with open(f, 'w') as fh:
fh.write('some content')
jaraco.path.build({'ok.txt': 'some content', '.nfs123abc': ''}, self.target)

copy_tree(self.target, self.target2)
assert os.listdir(self.target2) == ['ok.txt']
Expand Down

0 comments on commit b060f26

Please sign in to comment.