Avoid wrapping testsuites in sub-shell
This commit is contained in:
parent
c4676cfd33
commit
1830f71c82
|
@ -109,7 +109,7 @@ PULUMI_BIN := $(PULUMI_ROOT)/bin
|
|||
PULUMI_NODE_MODULES := $(PULUMI_ROOT)/node_modules
|
||||
PULUMI_NUGET := $(PULUMI_ROOT)/nuget
|
||||
|
||||
RUN_TESTSUITE = python ${PROJECT_ROOT}/scripts/run-testsuite.py
|
||||
TESTSUITE_SKIPPED = python ${PROJECT_ROOT}/scripts/skipped.py
|
||||
GO_TEST_FAST = python ${PROJECT_ROOT}/scripts/go-test.py -short -count=1 -cover -tags=all -timeout 1h -parallel ${TESTPARALLELISM}
|
||||
GO_TEST = python $(PROJECT_ROOT)/scripts/go-test.py -count=1 -cover -timeout 1h -tags=all -parallel ${TESTPARALLELISM}
|
||||
GOPROXY = 'https://proxy.golang.org'
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
"""
|
||||
Wraps test suite invocation shell commands to measure time and
|
||||
provide awareness of test configurations set by PULUMI_TEST_SUBSET.
|
||||
"""Determines if a testsuite is skipped according to
|
||||
PULUMI_TEST_SUBSET.
|
||||
|
||||
"""
|
||||
|
||||
from test_subsets import TEST_SUBSETS
|
||||
import os
|
||||
import subprocess as sp
|
||||
import sys
|
||||
import timeit
|
||||
|
||||
|
||||
testsuite_name = sys.argv[1]
|
||||
|
@ -34,12 +32,5 @@ def should_run():
|
|||
if not should_run():
|
||||
print(f'TESTSUITE {testsuite_name} skipped according to PULUMI_TEST_SUBSET={test_subset}')
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
t0 = timeit.timeit()
|
||||
try:
|
||||
sp.check_call(testsuite_command, shell=False)
|
||||
finally:
|
||||
t1 = timeit.timeit()
|
||||
elapsed = t1 - t0
|
||||
print(f'TESTSUITE {testsuite_name} completed in {elapsed}')
|
||||
else:
|
||||
sys.exit(1)
|
|
@ -45,11 +45,11 @@ install:: build install_plugin
|
|||
|
||||
dotnet_test:: $(TEST_ALL_DEPS)
|
||||
# include the version prefix/suffix to avoid generating a separate nupkg file
|
||||
$(RUN_TESTSUITE) dotnet-test dotnet test --no-build --filter --filter FullyQualifiedName\\!~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
|
||||
$(TESTSUITE_SKIPPED) dotnet-test || dotnet test --no-build --filter --filter FullyQualifiedName\\!~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
|
||||
|
||||
auto_test:: $(TEST_ALL_DEPS)
|
||||
# include the version prefix/suffix to avoid generating a separate nupkg file
|
||||
$(RUN_TESTSUITE) auto-dotnet dotnet test --no-build --filter --filter FullyQualifiedName~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
|
||||
$(TESTSUITE_SKIPPED) auto-dotnet || dotnet test --no-build --filter --filter FullyQualifiedName~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
|
||||
|
||||
test_fast:: dotnet_test
|
||||
$(GO_TEST_FAST) ${PROJECT_PKGS}
|
||||
|
|
|
@ -47,13 +47,13 @@ install_plugin:: build
|
|||
install:: install_package install_plugin
|
||||
|
||||
istanbul_tests:: $(TEST_ALL_DEPS)
|
||||
$(RUN_TESTSUITE) istanbul yarn run istanbul test --print none _mocha -- --timeout 120000 --exclude 'bin/tests/automation/**/*.spec.js' 'bin/tests/**/*.spec.js'
|
||||
$(TESTSUITE_SKIPPED) istanbul || istanbul test --print none _mocha -- --timeout 120000 --exclude 'bin/tests/automation/**/*.spec.js' 'bin/tests/**/*.spec.js'
|
||||
istanbul report text-summary
|
||||
istanbul report text
|
||||
$(RUN_TESTSUITE) istanbul-with-mocks yarn run istanbul test --print none _mocha -- 'bin/tests_with_mocks/**/*.spec.js'
|
||||
$(TESTSUITE_SKIPPED) istanbul-with-mocks || istanbul test --print none _mocha -- 'bin/tests_with_mocks/**/*.spec.js'
|
||||
|
||||
auto_tests:: $(TEST_ALL_DEPS)
|
||||
$(RUN_TESTSUITE) auto-nodejs yarn run istanbul test --print none _mocha -- --timeout 120000 'bin/tests/automation/**/*.spec.js'
|
||||
$(TESTSUITE_SKIPPED) auto-nodejs || istanbul test --print none _mocha -- --timeout 120000 'bin/tests/automation/**/*.spec.js'
|
||||
istanbul report text-summary
|
||||
istanbul report text
|
||||
|
||||
|
|
|
@ -50,14 +50,14 @@ test_fast:: $(TEST_ALL_DEPS)
|
|||
$(GO_TEST) ${PROJECT_PKGS}
|
||||
pipenv install -e ./env/src
|
||||
# TODO the ignored test seems to fail in pytest but not unittest. Need to trackdown why
|
||||
$(RUN_TESTSUITE) python/lib/test pipenv run pytest lib/test --ignore lib/test/automation --ignore lib/test/langhost/resource_thens/test_resource_thens.py
|
||||
$(RUN_TESTSUITE) python/lib/test/langhost/resource_thens pipenv run python -m unittest lib/test/langhost/resource_thens/test_resource_thens.py
|
||||
$(TESTSUITE_SKIPPED) python/lib/test || pipenv run pytest lib/test --ignore lib/test/automation --ignore lib/test/langhost/resource_thens/test_resource_thens.py
|
||||
$(TESTSUITE_SKIPPED) python/lib/test/langhost/resource_thens || pipenv run python -m unittest lib/test/langhost/resource_thens/test_resource_thens.py
|
||||
# Using python -m also adds lib/test_with_mocks to sys.path which avoids package resolution issues.
|
||||
pushd lib/test_with_mocks; $(RUN_TESTSUITE) python/lib/test_with_mocks pipenv run python -m pytest; popd
|
||||
pushd lib/test_with_mocks; $(TESTSUITE_SKIPPED) python/lib/test_with_mocks || pipenv run python -m pytest; popd
|
||||
|
||||
test_auto:: test_fast $(TEST_ALL_DEPS)
|
||||
# Note that this target depends on test-fast for the call to `pipenv run pip install`
|
||||
$(RUN_TESTSUITE) auto-python pipenv run pytest lib/test/automation
|
||||
$(TESTSUITE_SKIPPED) auto-python || pipenv run pytest lib/test/automation
|
||||
|
||||
test_all:: test_fast test_auto
|
||||
|
||||
|
|
Loading…
Reference in a new issue