-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TST: Avoid package collisions in subpackage tests
Package collisions cause errors.
- Loading branch information
Showing
4 changed files
with
64 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 40 additions & 28 deletions
68
tests/test-recipes/split-packages/copying_files/subpackage_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,69 @@ | ||
import os | ||
|
||
if os.getenv('PKG_NAME') == 'my_script_subpackage_files': | ||
|
||
file_basename = 'subpackage_file1' | ||
|
||
external_host_file = 'lib/libpng16.so' | ||
if 'osx' in os.getenv('target_platform', ''): | ||
external_host_file = 'lib/libpng16.dylib' | ||
if 'win' in os.getenv('target_platform', ''): | ||
external_host_file = 'Library/bin/libpng16.dll' | ||
|
||
filename = os.path.join(os.environ['PREFIX'], f'{file_basename}3.ext') | ||
assert os.path.isfile(filename) | ||
print('glob files OK') | ||
|
||
filename = os.path.join(os.environ['PREFIX'], external_host_file) | ||
assert os.path.isfile(filename) | ||
print('glob files prefix OK') | ||
|
||
if os.getenv('PKG_NAME') == 'my_script_subpackage_include_exclude': | ||
|
||
file_basename = 'subpackage_include_exclude1' | ||
|
||
external_host_file = 'lib/libdav1d.so.6' | ||
if 'osx' in os.getenv('target_platform', ''): | ||
external_host_file = 'lib/libdav1d.6.dylib' | ||
if 'win' in os.getenv('target_platform', ''): | ||
external_host_file = 'Library/bin/dav1d.dll' | ||
|
||
filename = os.path.join(os.environ['PREFIX'], f'{file_basename}3.ext') | ||
assert not os.path.isfile(filename) | ||
print('glob exclude OK') | ||
|
||
filename = os.path.join(os.environ['PREFIX'], external_host_file) | ||
assert not os.path.isfile(filename) | ||
print('glob exclude prefix OK') | ||
|
||
print(os.getenv('PREFIX')) | ||
filename = os.path.join(os.environ['PREFIX'], 'subpackage_file1') | ||
filename = os.path.join(os.environ['PREFIX'], f'{file_basename}1') | ||
assert os.path.isfile(filename) | ||
contents = open(filename).read().rstrip() | ||
if hasattr(contents, 'decode'): | ||
contents = contents.decode() | ||
assert 'weee' in contents, 'incorrect file contents: %s' % contents | ||
print('plain file OK') | ||
|
||
filename = os.path.join(os.environ['PREFIX'], 'somedir', 'subpackage_file1') | ||
filename = os.path.join(os.environ['PREFIX'], 'somedir', f'{file_basename}1') | ||
assert os.path.isfile(filename), filename + ' is missing' | ||
contents = open(filename).read().rstrip() | ||
if hasattr(contents, 'decode'): | ||
contents = contents.decode() | ||
assert 'weee' in contents, 'incorrect file contents: %s' % contents | ||
print('subfolder file OK') | ||
|
||
filename = os.path.join(os.environ['PREFIX'], 'subpackage_file1.ext') | ||
filename = os.path.join(os.environ['PREFIX'], f'{file_basename}1.ext') | ||
assert os.path.isfile(filename) | ||
contents = open(filename).read().rstrip() | ||
if hasattr(contents, 'decode'): | ||
contents = contents.decode() | ||
assert 'weee' in contents, 'incorrect file contents: %s' % contents | ||
|
||
filename = os.path.join(os.environ['PREFIX'], 'subpackage_file2.ext') | ||
filename = os.path.join(os.environ['PREFIX'], f'{file_basename}2.ext') | ||
assert os.path.isfile(filename) | ||
contents = open(filename).read().rstrip() | ||
if hasattr(contents, 'decode'): | ||
contents = contents.decode() | ||
assert 'weee' in contents, 'incorrect file contents: %s' % contents | ||
print('glob OK') | ||
|
||
external_host_file = 'lib/libdav1d.so.6' | ||
if 'osx' in os.getenv('target_platform', ''): | ||
external_host_file = 'lib/libdav1d.6.dylib' | ||
if 'win' in os.getenv('target_platform', ''): | ||
external_host_file = 'Library/bin/dav1d.dll' | ||
|
||
if os.getenv('PKG_NAME') == 'my_script_subpackage_files': | ||
filename = os.path.join(os.environ['PREFIX'], 'subpackage_file3.ext') | ||
assert os.path.isfile(filename) | ||
print('glob files OK') | ||
|
||
filename = os.path.join(os.environ['PREFIX'], external_host_file) | ||
assert os.path.isfile(filename) | ||
print('glob files prefix OK') | ||
|
||
if os.getenv('PKG_NAME') == 'my_script_subpackage_include_exclude': | ||
filename = os.path.join(os.environ['PREFIX'], 'subpackage_file3.ext') | ||
assert not os.path.isfile(filename) | ||
print('glob exclude OK') | ||
|
||
filename = os.path.join(os.environ['PREFIX'], external_host_file) | ||
assert not os.path.isfile(filename) | ||
print('glob exclude prefix OK') |