From a6185d92366cf582010c3eb3e837ed0d8e1da49b Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 14 Jul 2023 10:55:35 -0700 Subject: [PATCH] Add support for gRPC port in pytest tests --- python/tests/conftest.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/tests/conftest.py b/python/tests/conftest.py index be1fc48..5cfd351 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -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: @@ -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