Skip to content

Commit

Permalink
Make a CI conditional skip that actually works, unlike ChatGPT's sugg…
Browse files Browse the repository at this point in the history
…estion
  • Loading branch information
ovidner committed Jan 26, 2024
1 parent 30830f3 commit d68bc5b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@
import pytest


def is_running_in_github_actions():
# See https://docs.github.com/en/actions/learn-github-actions/variables
return os.getenv("GITHUB_ACTIONS", "false") == "true"
@pytest.fixture
def test_scenes_path():
return pathlib.Path(__file__).parent / "scenes"


skip_in_ci = pytest.mark.skipif(is_running_in_github_actions(), reason="Skipping in CI")
@pytest.fixture
def in_ci():
# See https://docs.github.com/en/actions/learn-github-actions/variables
return os.getenv("GITHUB_ACTIONS", "false") == "true"


@pytest.fixture
def test_scenes_path():
return pathlib.Path(__file__).parent / "scenes"
def skip_in_ci(in_ci):
if in_ci:
pytest.skip("Skipping in CI")
return


@pytest.fixture
@skip_in_ci
def ips_instance():
def ips_instance(skip_in_ci):
from autopack.ips_communication.ips_class import IPSInstance

ips = IPSInstance()
Expand Down

0 comments on commit d68bc5b

Please sign in to comment.