Skip to content

Commit

Permalink
fix: add env variable for CARLA path and blueprint tests with manual …
Browse files Browse the repository at this point in the history
…skip
  • Loading branch information
Armando Banuelos authored and Armando Banuelos committed Apr 12, 2024
1 parent cefecc4 commit 18521b0
Show file tree
Hide file tree
Showing 3 changed files with 365 additions and 5 deletions.
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ test-full = [ # like 'test' but adds dependencies for optional features
"scenic[test]", # all dependencies from 'test' extra above
"scenic[guideways]", # for running guideways modules
"astor >= 0.8.1",
"carla >= 0.9.12",
"dill",
"exceptiongroup",
"inflect ~= 5.5",
Expand All @@ -73,9 +74,6 @@ test-full = [ # like 'test' but adds dependencies for optional features
"sphinx-tabs ~= 3.4.1",
"verifai >= 2.1.0b1",
]
test-sim = [
'carla >= 0.9.12; python_version <= "3.8" and (platform_system == "Linux" or platform_system == "Windows")',
]
dev = [
"scenic[test-full]",
"black ~= 24.0",
Expand Down
11 changes: 10 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from contextlib import contextmanager
import os
import os.path
from pathlib import Path
import re
Expand Down Expand Up @@ -53,10 +54,18 @@ def loader(relpath, **kwargs):
return loader


def checkCarlaPath():
CARLA_ROOT = os.environment.get("CARLA_ROOT")
if not CARLA_ROOT:
pytest.skip("CARLA_ROOT env variable not set.")
return CARLA_ROOT


@pytest.fixture
def launchCarlaServer():
CARLA_ROOT = checkCarlaPath()
carla_process = subprocess.Popen(
"bash /opt/carla-simulator/CarlaUE4.sh -RenderOffScreen", shell=True
f"bash {CARLA_ROOT}/CarlaUE4.sh -RenderOffScreen", shell=True
)
# NOTE: CARLA server takes time to start up
time.sleep(3)
Expand Down
Loading

0 comments on commit 18521b0

Please sign in to comment.