forked from goodboy/tractor
1
0
Fork 0

Simplified CI detection

matrix
Guillermo Rodriguez 2020-09-03 09:44:24 -03:00
parent 03e5852acf
commit c993e36e95
No known key found for this signature in database
GPG Key ID: 3F61096EC7DF75A8
2 changed files with 7 additions and 23 deletions

View File

@ -8,9 +8,6 @@ import random
import signal
import platform
import time
import enum
from typing import Optional
import pytest
import tractor
@ -77,21 +74,11 @@ def spawn_backend(request):
return request.config.option.spawn_backend
class CIEnvoirment(enum.Enum):
Travis = 'TRAVIS'
Github = 'GITHUB'
@pytest.fixture(scope='session')
def ci_env() -> Optional[CIEnvoirment]:
def ci_env() -> bool:
"""Detect CI envoirment.
"""
if os.environ.get('TRAVIS'):
return CIEnvoirment.Travis
elif os.environ.get('CI'):
return CIEnvoirment.Github
else:
return None
return os.environ.get('TRAVIS', False) or os.environ.get('CI', False)
@pytest.fixture(scope='session')

View File

@ -9,8 +9,6 @@ import trio
import tractor
import pytest
from conftest import CIEnvoirment
def test_must_define_ctx():
@ -205,12 +203,11 @@ async def cancel_after(wait):
@pytest.fixture(scope='module')
def time_quad_ex(arb_addr, ci_env, spawn_backend):
if ci_env in (CIEnvoirment.Github, CIEnvoirment.Travis):
if spawn_backend == 'mp' and (platform.system() != 'Windows'):
"""no idea, but the travis and github actions, mp *nix runs are
flaking out here often
"""
pytest.skip("Test is too flaky on mp in CI")
if ci_env and spawn_backend == 'mp' and (platform.system() != 'Windows'):
"""no idea, but the travis and github actions, mp *nix runs are
flaking out here often
"""
pytest.skip("Test is too flaky on mp in CI")
timeout = 7 if platform.system() in ('Windows', 'Darwin') else 4
start = time.time()