Skip to content

Commit

Permalink
Fix shell syntax in build_wheel
Browse files Browse the repository at this point in the history
Follow up to #11872
The cross repo split makes this a bit of a pain to test.
  • Loading branch information
hauntsaninja committed Dec 30, 2021
1 parent 22d4f1d commit f1a2390
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
13 changes: 9 additions & 4 deletions misc/build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ def create_environ(python_version: str) -> Dict[str, str]:

# lxml doesn't have a wheel for Python 3.10 on the manylinux image we use.
# lxml has historically been slow to support new Pythons as well.
env['CIBW_BEFORE_TEST'] = (
'pip install -r <(grep -v lxml {project}/mypy/test-requirements.txt)'
)
env['CIBW_BEFORE_TEST'] = """
(
grep -v lxml {project}/mypy/test-requirements.txt > /tmp/test-requirements.txt
&& cp {project}/mypy/mypy-requirements.txt /tmp/mypy-requirements.txt
&& cp {project}/mypy/build-requirements.txt /tmp/build-requirements.txt
&& pip install -r /tmp/test-requirements.txt
)
""".replace('\n', ' ')

# pytest looks for configuration files in the parent directories of where the tests live.
# since we are trying to run the tests from their installed location, we copy those into
Expand All @@ -94,7 +99,7 @@ def create_environ(python_version: str) -> Dict[str, str]:
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR -k 'not (reports.test or testreports)'
&& MYPYC_TEST_DIR=$(python -c 'import mypyc.test; print(mypyc.test.__path__[0])')
&& pytest $MYPYC_TEST_DIR -k 'not test_external'
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPYC_TEST_DIR -k 'not test_external'
)
""".replace('\n', ' ')

Expand Down
12 changes: 8 additions & 4 deletions mypyc/test/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import os

this_file_dir = os.path.dirname(os.path.realpath(__file__))
prefix = os.path.dirname(os.path.dirname(this_file_dir))
provided_prefix = os.getenv('MYPY_TEST_PREFIX', None)
if provided_prefix:
PREFIX = provided_prefix
else:
this_file_dir = os.path.dirname(os.path.realpath(__file__))
PREFIX = os.path.dirname(os.path.dirname(this_file_dir))

# Locations of test data files such as test case descriptions (.test).
test_data_prefix = os.path.join(prefix, 'mypyc', 'test-data')
# Location of test data files such as test case descriptions.
test_data_prefix = os.path.join(PREFIX, 'mypyc', 'test-data')

0 comments on commit f1a2390

Please sign in to comment.