Skip to content

Commit

Permalink
tests: Avoid modifying '17 prebuild shared' test dir
Browse files Browse the repository at this point in the history
Tests can tread on each other's toes when parallelism is high enough.

In this case, `test_prebuilt_shared_lib` creates an object file in the
`17 prebuilt shared` test dir.

`test_prebuilt_shared_lib_rpath_same_prefix` uses `shutil.copytree` to
copy that same test dir to a temporary location.

If the former test cleans up its object file while `copytree` is
running, the copy can fail with a fatal ENOENT `shutil.Error`.

Use `copy_srcdir` to prevent this from happening.
  • Loading branch information
heftig authored and jpakkane committed Jan 7, 2025
1 parent c66a89f commit 29a26ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion unittests/allplatformstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ def build_shared_lib(self, compiler, source, objectfile, outfile, impfile, extra

def test_prebuilt_shared_lib(self):
(cc, _, object_suffix, shared_suffix) = self.detect_prebuild_env()
tdir = os.path.join(self.unit_test_dir, '17 prebuilt shared')
tdir = self.copy_srcdir(os.path.join(self.unit_test_dir, '17 prebuilt shared'))
source = os.path.join(tdir, 'alexandria.c')
objectfile = os.path.join(tdir, 'alexandria.' + object_suffix)
impfile = os.path.join(tdir, 'alexandria.lib')
Expand Down

0 comments on commit 29a26ea

Please sign in to comment.