Skip to content

Commit

Permalink
Add support for gRPC port in pytest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
huffman committed Jul 14, 2023
1 parent 779e888 commit a6185d9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
def pytest_addoption(parser):
parser.addoption('--use-existing', action='store_true')
parser.addoption('--app-path', action='store')
parser.addoption('--port', action='store', type=int)

@pytest.fixture
def asset_path() -> str:
Expand All @@ -16,13 +17,15 @@ def asset_path() -> str:
@pytest.fixture(scope='session')
def manager(request):
app_path = request.config.getoption('--app-path')

port = request.config.getoption('--port')
if app_path is not None:
with saleae.automation.Manager.launch(app_path) as mgr:
with saleae.automation.Manager.launch(app_path, port=port) as mgr:
yield mgr
pass
elif request.config.getoption('--use-existing'):
with saleae.automation.Manager.connect(port=10430) as mgr:
with saleae.automation.Manager.connect(port=port) as mgr:
yield mgr
else:
with saleae.automation.Manager.launch() as mgr:
with saleae.automation.Manager.launch(port=port) as mgr:
yield mgr

0 comments on commit a6185d9

Please sign in to comment.