Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move platform-specific testing to its own subdirectory of python tasks for 1:1:1 #6841

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from distutils.core import Extension


c_module = Extension(b'c_greet', sources=[b'c_greet.c'])
cpp_module = Extension(b'cpp_greet', sources=[b'cpp_greet.cpp'])
c_module = Extension('c_greet', sources=['c_greet.c'])
cpp_module = Extension('cpp_greet', sources=['cpp_greet.cpp'])

setup(
name='fasthello',
Expand Down
25 changes: 17 additions & 8 deletions src/python/pants/backend/python/subsystems/python_native_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,22 @@ def as_environment(self):
c_linker.path_entries +
cpp_compiler.path_entries +
cpp_linker.path_entries)
# TODO(#6273): We prepend our toolchain to the PATH instead of overwriting it -- we need
# better control of the distutils compilation environment if we want to actually isolate the
# PATH (distutils does lots of sneaky things).
ret['PATH'] = create_path_env_var(all_path_entries, env=os.environ.copy(), prepend=True)

# GCC will output smart quotes in a variety of situations (leading to decoding errors
# downstream) unless we set this environment variable.
ret['LC_ALL'] = 'C'

# TODO(#6273): we are constructing an informally-composed environment for consumption by
# distutils in order to set CC, CXX, LDSHARED, LIBRARY_PATH, and (DY)LD_LIBRARY_PATH so the
# compilers will run.
ret.update(cpp_linker.as_invocation_environment_dict)
ret.update(cpp_compiler.as_invocation_environment_dict)

ret.update({
# TODO(#6273): We prepend our toolchain to the PATH instead of overwriting it -- we need
# better control of the distutils compilation environment if we want to actually isolate the
# PATH (distutils does lots of sneaky things).
'PATH': create_path_env_var(all_path_entries, env=os.environ.copy(), prepend=True),
# GCC will output smart quotes in a variety of situations (leading to decoding errors
# downstream because pex prints directly to stderr) unless we set this environment variable,
# so compile errors are impossible to see otherwise.
'LC_ALL': 'C',
})

return ret
106 changes: 2 additions & 104 deletions tests/python/pants_test/backend/python/tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,85 +21,8 @@ python_library(
]
)

python_native_code_test_files = [
'test_build_local_python_distributions.py',
'test_python_distribution_integration.py',
'test_ctypes.py',
'test_ctypes_integration.py',
]

python_tests(
name='python_native_code_testing_3',
sources=[
python_native_code_test_files[0],
],
dependencies=[
'3rdparty/python:future',
'3rdparty/python/twitter/commons:twitter.common.collections',
'src/python/pants/backend/native',
'src/python/pants/backend/native/targets',
'src/python/pants/backend/python:plugin',
'src/python/pants/backend/python/targets',
'src/python/pants/backend/python/tasks',
'src/python/pants/util:contextutil',
'src/python/pants/util:process_handler',
'tests/python/pants_test:int-test',
'tests/python/pants_test/backend/python/tasks/util',
'tests/python/pants_test/engine:scheduler_test_base',
'tests/python/pants_test/testutils:py2_compat',
],
tags={'platform_specific_behavior', 'integration'},
timeout=2400,
)

python_tests(
name='python_native_code_testing_2',
sources=[
python_native_code_test_files[1],
],
dependencies=[
'3rdparty/python:future',
'3rdparty/python/twitter/commons:twitter.common.collections',
'src/python/pants/backend/native',
'src/python/pants/backend/native/targets',
'src/python/pants/backend/python:plugin',
'src/python/pants/backend/python/targets',
'src/python/pants/backend/python/tasks',
'src/python/pants/util:contextutil',
'src/python/pants/util:process_handler',
'tests/python/pants_test:int-test',
'tests/python/pants_test/backend/python/tasks/util',
'tests/python/pants_test/engine:scheduler_test_base',
'tests/python/pants_test/testutils:py2_compat',
],
tags={'platform_specific_behavior', 'integration'},
timeout=2400,
)

python_tests(
name='python_native_code_testing_1',
sources=python_native_code_test_files[2:],
dependencies=[
'3rdparty/python:future',
'3rdparty/python/twitter/commons:twitter.common.collections',
'src/python/pants/backend/native',
'src/python/pants/backend/native/targets',
'src/python/pants/backend/python:plugin',
'src/python/pants/backend/python/targets',
'src/python/pants/backend/python/tasks',
'src/python/pants/util:contextutil',
'src/python/pants/util:process_handler',
'tests/python/pants_test:int-test',
'tests/python/pants_test/backend/python/tasks/util',
'tests/python/pants_test/engine:scheduler_test_base',
'tests/python/pants_test/testutils:py2_compat',
],
tags={'platform_specific_behavior', 'integration'},
timeout=2400,
)

python_tests(
sources=globs('test_*.py', exclude=([globs('*_integration.py')] + python_native_code_test_files)),
sources=globs('test_*.py', exclude=[globs('*_integration.py')]),
dependencies=[
'3rdparty/python/twitter/commons:twitter.common.collections',
'3rdparty/python/twitter/commons:twitter.common.dirutil',
Expand Down Expand Up @@ -137,7 +60,7 @@ python_tests(

python_tests(
name='integration',
sources=globs('*_integration.py', exclude=python_native_code_test_files),
sources=globs('*_integration.py'),
dependencies=[
'3rdparty/python:pex',
'src/python/pants/base:build_environment',
Expand All @@ -152,28 +75,3 @@ python_tests(
tags={'integration'},
timeout=2400
)

python_tests(
name='isort_run_integration',
sources=['test_isort_run_integration.py'],
dependencies=[
'tests/python/pants_test:int-test',
'tests/python/pants_test/backend/python/tasks:python_task_test_base',
],
tags={'integration'},
)

python_tests(
name='isort_run',
sources=['test_isort_run.py'],
dependencies=[
'3rdparty/python:future',
'src/python/pants/util:dirutil',
'tests/python/pants_test/backend/python/tasks:python_task_test_base',
'src/python/pants/util:process_handler',
'tests/python/pants_test:test_base',
'tests/python/pants_test/subsystem:subsystem_utils',
'tests/python/pants_test:task_test_base',
],
timeout=300
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
python_tests(
sources=globs('test_*.py', exclude=[globs('*_integration.py')]),
dependencies = [
'3rdparty/python:future',
'3rdparty/python/twitter/commons:twitter.common.collections',
'src/python/pants/backend/native/targets',
'src/python/pants/backend/python/targets',
'src/python/pants/util:contextutil',
'tests/python/pants_test/backend/python/tasks/util',
],
tags={'platform_specific_behavior'},
)

python_tests(
name='integration',
sources=globs('*_integration.py'),
dependencies=[
'3rdparty/python:future',
'src/python/pants/backend/native/config',
'src/python/pants/util:collections',
'src/python/pants/util:contextutil',
'src/python/pants/util:dirutil',
'src/python/pants/util:process_handler',
'tests/python/pants_test:int-test',
'tests/python/pants_test/backend/python/tasks:python_task_test_base',
'tests/python/pants_test/testutils:py2_compat',
],
tags={'platform_specific_behavior', 'integration'},
timeout=2400,
)