Skip to content

armgit / fli

Public Imported from GitHub
0

Google Flights MCP, CLI and Python Library

Add fuzz pytest marker

Punit Arani4e2331d01331
diff --git a/Makefile b/Makefile
index 6284b1c..b55d897 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,11 @@ lint-fix:
# Run tests
test:
- poetry run pytest -vv -n 8 -m parallel
+ poetry run pytest -vv
+test-fuzz:
+ poetry run pytest -vv --fuzz
+test-all:
+ poetry run pytest -vv --all
# Run the app
run:
diff --git a/pytest.ini b/pytest.ini
new file mode 100644
index 0000000..d8c2c8a
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,4 @@
+[pytest]
+markers =
+ fuzz: mark test to run only with --fuzz flag
+ parallel: mark test to run in parallel with pytest-xdist
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..b733051
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,14 @@
+import pytest
+
+
+def pytest_addoption(parser):
+ parser.addoption("--fuzz", action="store_true", help="Run fuzz tests")
+ parser.addoption("--all", action="store_true", help="Run all tests")
+
+
+def pytest_runtest_setup(item):
+ """Skip fuzz tests unless --fuzz or --all is specified."""
+ fuzz_marker = item.get_closest_marker("fuzz")
+ if fuzz_marker is not None:
+ if not item.config.getoption("--fuzz") and not item.config.getoption("--all"):
+ pytest.skip("need --fuzz or --all option to run this test")
diff --git a/tests/test_search_fuzz.py b/tests/test_search_fuzz.py
index 9405438..b35f931 100644
--- a/tests/test_search_fuzz.py
+++ b/tests/test_search_fuzz.py
@@ -80,6 +80,7 @@ def generate_random_test_cases(num_tests: int) -> List[Tuple]:
return test_cases
@pytest.mark.parallel
@pytest.mark.parametrize(
"dep_airport, arr_airport, dep_date, adults, children, infants_on_lap, infants_in_seat, seat_type, stops, sort_by",
@@ -98,7 +99,6 @@ def test_search_fuzz(
seat_type: SeatType,
stops: MaxStops,
sort_by: SortBy,
- capfd,
):
"""
Parameterized fuzz test for flight search with various filter combinations.