Skip to content

Commit

Permalink
Miscellaneous pytest improvements (opencis#125)
Browse files Browse the repository at this point in the history
- Makefile: remove *.bin after test
- Fix tests/test_cxl_host.py race-conditions due to duplicate ports

Signed-off-by: Juhyung Park <[email protected]>
Signed-off-by: Kyeyoon Park <[email protected]>
  • Loading branch information
arter97 authored Oct 24, 2024
1 parent c2bac21 commit 8e94157
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__pycache__
*.log
.coverage
.coverage*
*.bin
*.patch
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ else
endif

test:
poetry run python3 -O -m compileall -q opencxl tests
poetry run pytest --cov --cov-report=term-missing -n $(NPROC)
rm -f mem*.bin
rm -f *.bin

lint:
poetry run pylint opencxl
Expand Down
16 changes: 8 additions & 8 deletions tests/test_cxl_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ async def test_cxl_host_util_client():
@pytest.mark.asyncio
async def test_cxl_host_type3_ete():
# pylint: disable=protected-access
host_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 49
host_port = BASE_TEST_PORT + pytest.PORT.TEST_5
util_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 50
switch_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 51
switch_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 60

port_configs = [
PortConfig(PORT_TYPE.USP),
Expand Down Expand Up @@ -357,9 +357,9 @@ async def test_cxl_host_type3_ete():
# @pytest.mark.asyncio
# async def test_cxl_host_type3_ete_bi_only():
# # pylint: disable=protected-access
# host_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 55
# util_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 56
# switch_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 57
# host_port = BASE_TEST_PORT + pytest.PORT.TEST_6
# util_port = BASE_TEST_PORT + pytest.PORT.TEST_6 + 50
# switch_port = BASE_TEST_PORT + pytest.PORT.TEST_6 + 60

# port_configs = [
# PortConfig(PORT_TYPE.USP),
Expand Down Expand Up @@ -459,9 +459,9 @@ async def test_cxl_host_type3_ete():
# @pytest.mark.asyncio
# async def test_cxl_host_type2_ete():
# # pylint: disable=protected-access
# host_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 52
# util_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 53
# switch_port = BASE_TEST_PORT + pytest.PORT.TEST_5 + 54
# host_port = BASE_TEST_PORT + pytest.PORT.TEST_7
# util_port = BASE_TEST_PORT + pytest.PORT.TEST_7 + 50
# switch_port = BASE_TEST_PORT + pytest.PORT.TEST_7 + 60

# port_configs = [
# PortConfig(PORT_TYPE.USP),
Expand Down

0 comments on commit 8e94157

Please sign in to comment.