From 0333d1fa361537b3c3e0717a759464cca7ca75d9 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Thu, 8 Sep 2022 22:39:42 +0900 Subject: [PATCH] CI Fix pytest runtime option syntax (#3084) --- .circleci/config.yml | 24 ++++++++++++------------ .github/workflows/main.yml | 8 ++++---- conftest.py | 23 ++++++++++++++--------- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c0baba46..d72f12df3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -591,7 +591,7 @@ workflows: - test-main: name: test-core-chrome - test-params: --runtime chrome -k "not webworker" src packages/micropip packages/fpcast-test packages/sharedlib-test-py/ packages/cpp-exceptions-test/ + test-params: --runtime=chrome-no-host -k "not webworker" src packages/micropip packages/fpcast-test packages/sharedlib-test-py/ packages/cpp-exceptions-test/ requires: - build-core filters: @@ -600,7 +600,7 @@ workflows: - test-main: name: test-core-firefox - test-params: --runtime firefox -k "not webworker" src packages/micropip packages/fpcast-test packages/sharedlib-test-py/ packages/cpp-exceptions-test/ + test-params: --runtime=firefox-no-host -k "not webworker" src packages/micropip packages/fpcast-test packages/sharedlib-test-py/ packages/cpp-exceptions-test/ requires: - build-core filters: @@ -609,7 +609,7 @@ workflows: - test-main: name: test-core-node - test-params: --runtime node src packages/micropip packages/fpcast-test packages/sharedlib-test-py/ packages/cpp-exceptions-test/ + test-params: --runtime=node-no-host src packages/micropip packages/fpcast-test packages/sharedlib-test-py/ packages/cpp-exceptions-test/ requires: - build-core filters: @@ -618,7 +618,7 @@ workflows: - test-main-macos: name: test-core-safari - test-params: --runtime safari src packages/micropip packages/fpcast-test packages/sharedlib-test-py/ packages/cpp-exceptions-test/ + test-params: --runtime=safari-no-host src packages/micropip packages/fpcast-test packages/sharedlib-test-py/ packages/cpp-exceptions-test/ requires: - build-core filters: @@ -627,7 +627,7 @@ workflows: - test-main: name: test-core-chrome-webworker - test-params: --runtime chrome src/tests/test_webworker.py + test-params: --runtime=chrome-no-host src/tests/test_webworker.py requires: - test-core-chrome filters: @@ -636,7 +636,7 @@ workflows: - test-main: name: test-core-firefox-webworker - test-params: --runtime firefox src/tests/test_webworker.py + test-params: --runtime=firefox-no-host src/tests/test_webworker.py requires: - test-core-firefox filters: @@ -645,7 +645,7 @@ workflows: - test-main: name: test-packages-chrome-no-numpy-dependents - test-params: --runtime chrome packages/*/test*.py + test-params: --runtime=chrome-no-host packages/*/test*.py cache-dir: .pytest_cache_chrome requires: - build-packages-no-numpy-dependents @@ -660,7 +660,7 @@ workflows: - test-main: name: test-packages-chrome - test-params: --runtime chrome packages/*/test*.py --skip-passed + test-params: --runtime=chrome-no-host packages/*/test*.py --skip-passed cache-dir: .pytest_cache_chrome requires: - test-packages-chrome-no-numpy-dependents @@ -671,7 +671,7 @@ workflows: - test-main: name: test-packages-firefox-no-numpy-dependents - test-params: --runtime firefox packages/*/test*.py + test-params: --runtime=firefox-no-host packages/*/test*.py cache-dir: .pytest_cache_firefox requires: - build-packages-no-numpy-dependents @@ -686,7 +686,7 @@ workflows: - test-main: name: test-packages-firefox - test-params: --runtime firefox packages/*/test*.py --skip-passed + test-params: --runtime=firefox-no-host packages/*/test*.py --skip-passed cache-dir: .pytest_cache_firefox requires: - test-packages-firefox-no-numpy-dependents @@ -697,7 +697,7 @@ workflows: - test-main: name: test-packages-node-no-numpy-dependents - test-params: --runtime node packages/*/test*.py + test-params: --runtime=node-no-host packages/*/test*.py cache-dir: .pytest_cache_node requires: - build-packages-no-numpy-dependents @@ -712,7 +712,7 @@ workflows: - test-main: name: test-packages-node - test-params: --runtime node packages/*/test*.py --skip-passed + test-params: --runtime=node-no-host packages/*/test*.py --skip-passed cache-dir: .pytest_cache_node requires: - test-packages-node-no-numpy-dependents diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 99c3dedfc..eb660a5e7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,9 +41,9 @@ jobs: PYODIDE_ROOT=. pytest \ --junitxml=test-results/junit.xml \ --verbose \ - --runtime host \ + --runtime=host \ --cov=pyodide_build --cov=pyodide \ - src pyodide-build packages/micropip/ + src pyodide-build packages/micropip/ packages/_tests - uses: codecov/codecov-action@v3 with: fail_ci_if_error: true @@ -170,7 +170,7 @@ jobs: ls -lh dist/ tools/pytest_wrapper.py src packages/micropip/ \ -v \ - --runtime "${BROWSER}" \ + --runtime="${BROWSER}-no-host" \ --runner "${RUNNER}" \ --durations 50 \ --junitxml=test-results/core_test.xml @@ -186,7 +186,7 @@ jobs: tools/pytest_wrapper.py packages/*/test* \ -v \ -k "numpy and not joblib" \ - --runtime "${BROWSER}" \ + --runtime="${BROWSER}-no-host" \ --runner "${RUNNER}" \ --durations 50 \ --junitxml=test-results/packages_test.xml diff --git a/conftest.py b/conftest.py index 2dc321320..df6799a24 100644 --- a/conftest.py +++ b/conftest.py @@ -73,17 +73,22 @@ def maybe_skip_test(item, delayed=False): # Common package import test. Skip it if the package is not built. if skip_msg is None and is_common_test and item.name.startswith("test_import"): - match = re.match(rf"test_import\[({browsers})-(?P[\w\-\.]+)\]", item.name) - if match: - package_name = match.group("name") - if not package_is_built(package_name): - # If the test is going to be skipped remove the - # selenium_standalone as it takes a long time to initialize - skip_msg = f"package '{package_name}' is not built." + if not pytest.pyodide_runtimes: # type: ignore[truthy-bool] + skip_msg = "Not running browser tests" + else: - raise AssertionError( - f"Couldn't parse package name from {item.name}. This should not happen!" + match = re.match( + rf"test_import\[({browsers})-(?P[\w\-\.]+)\]", item.name ) + if match: + package_name = match.group("name") + if not package_is_built(package_name): + # selenium_standalone as it takes a long time to initialize + skip_msg = f"package '{package_name}' is not built." + else: + raise AssertionError( + f"Couldn't parse package name from {item.name}. This should not happen!" + ) # If the test is going to be skipped remove the # TODO: also use this hook to skip doctests we cannot run (or run them # inside the selenium wrapper)