Skip to content

Commit

Permalink
Punch a hole for CI through tox envs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Oct 26, 2024
1 parent ce7bc6a commit d635311
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions testing/pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Copyright 2024 Pex project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import absolute_import

import os

IS_CI = "true" == os.environ.get("CI", "false")
10 changes: 8 additions & 2 deletions tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
)
from testing.mitmproxy import Proxy
from testing.pep_427 import get_installable_type_flag
from testing.pytest import IS_CI

if TYPE_CHECKING:
from typing import Any, Callable, Iterator, List, Optional, Tuple
Expand Down Expand Up @@ -384,7 +385,11 @@ def do_something():
assert rc == 1


@pytest.mark.flaky(retries=2, condition="true" == os.environ.get("CI", "false"))
CI_flaky = pytest.mark.CI_flaky(retries=2, condition=IS_CI)


# This test often fails when there is no devpi cache built up yet; so give it a few burns.
@CI_flaky
def test_pex_multi_resolve_1(tmpdir):
# type: (Any) -> None
"""Tests multi-interpreter + multi-platform resolution."""
Expand Down Expand Up @@ -591,7 +596,8 @@ def inherit_path(inherit_path):
assert requests_paths[0] > sys_paths[0]


@pytest.mark.flaky(retries=2, condition="true" == os.environ.get("CI", "false"))
# This test often fails when there is no devpi cache built up yet; so give it a few burns.
@CI_flaky
def test_pex_multi_resolve_2(tmpdir):
# type: (Any) -> None

Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ passenv =
_PEX_PEXPECT_TIMEOUT
# This allows experimenting with Requires-Python metadata adjustment.
_PEX_REQUIRES_PYTHON
# This allows tests to detect they are running in CI.
CI
# These are to support directing test environments to the correct headers on OSX.
CPATH
CPPFLAGS
Expand Down

0 comments on commit d635311

Please sign in to comment.