forked from goodboy/tractor
Simplified CI detection
parent
03e5852acf
commit
c993e36e95
|
@ -8,9 +8,6 @@ import random
|
||||||
import signal
|
import signal
|
||||||
import platform
|
import platform
|
||||||
import time
|
import time
|
||||||
import enum
|
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import tractor
|
import tractor
|
||||||
|
@ -77,21 +74,11 @@ def spawn_backend(request):
|
||||||
return request.config.option.spawn_backend
|
return request.config.option.spawn_backend
|
||||||
|
|
||||||
|
|
||||||
class CIEnvoirment(enum.Enum):
|
|
||||||
Travis = 'TRAVIS'
|
|
||||||
Github = 'GITHUB'
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
def ci_env() -> Optional[CIEnvoirment]:
|
def ci_env() -> bool:
|
||||||
"""Detect CI envoirment.
|
"""Detect CI envoirment.
|
||||||
"""
|
"""
|
||||||
if os.environ.get('TRAVIS'):
|
return os.environ.get('TRAVIS', False) or os.environ.get('CI', False)
|
||||||
return CIEnvoirment.Travis
|
|
||||||
elif os.environ.get('CI'):
|
|
||||||
return CIEnvoirment.Github
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
|
|
|
@ -9,8 +9,6 @@ import trio
|
||||||
import tractor
|
import tractor
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from conftest import CIEnvoirment
|
|
||||||
|
|
||||||
|
|
||||||
def test_must_define_ctx():
|
def test_must_define_ctx():
|
||||||
|
|
||||||
|
@ -205,8 +203,7 @@ async def cancel_after(wait):
|
||||||
|
|
||||||
@pytest.fixture(scope='module')
|
@pytest.fixture(scope='module')
|
||||||
def time_quad_ex(arb_addr, ci_env, spawn_backend):
|
def time_quad_ex(arb_addr, ci_env, spawn_backend):
|
||||||
if ci_env in (CIEnvoirment.Github, CIEnvoirment.Travis):
|
if ci_env and spawn_backend == 'mp' and (platform.system() != 'Windows'):
|
||||||
if spawn_backend == 'mp' and (platform.system() != 'Windows'):
|
|
||||||
"""no idea, but the travis and github actions, mp *nix runs are
|
"""no idea, but the travis and github actions, mp *nix runs are
|
||||||
flaking out here often
|
flaking out here often
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue