diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09af161..e2353f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,11 +31,23 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions pytest black coverage requests pytest-asyncio - - - name: Run tox + pip install tox tox-gh-actions \ + pytest \ + pytest-cov \ + pytest-asyncio \ + black \ + coverage \ + requests \ + httpx \ + asgi_lifespan \ + psutil \ + uvicorn \ + starlette \ + fastapi + + - name: Run tests run: | - make tox + make test-unit - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 diff --git a/Makefile b/Makefile index 9ff2380..9c1ce35 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,10 @@ TESTING: ## ############################################################ test: ## run tests python -m pytest -ra --junitxml=report.xml --cov-config=pyproject.toml --cov-report=xml --cov-report term --cov=$(pkg_src) tests/ +.PHONY: test-unit +test-unit: ## run all tests except "integration" marked + RUN_ENV=local python -m pytest -m "not (integration or e2e)" --cov-config=pyproject.toml --cov-report=html --cov-report=term --cov=$(pkg_src) tests + .PHONY: tox tox: ## Run tox tox diff --git a/pyproject.toml b/pyproject.toml index 00f91ae..300b256 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,14 @@ Source = "https://github.com/sysid/sse-starlette" [project.optional-dependencies] examples = ["fastapi"] +[tool.pytest.ini_options] +markers = [ + "integration: marks tests as integration tests", + "e2e: marks tests as e2e tests, not to be run in CICD" +] +asyncio_mode = "auto" +#addopts = "--cov=my_package --cov-report=term-missing" + [tool.bumpversion] current_version = "2.0.0" commit = true @@ -89,12 +97,6 @@ dev = [ "psutil", "black>=23.11.0", ] -[tool.pytest.ini_options] -markers = [ - "integration: marks tests as integration tests", -] -asyncio_mode = "auto" -#addopts = "--cov=my_package --cov-report=term-missing" [tool.isort] multi_line_output = 3 diff --git a/tests/integration/test_multiple_consumers.py b/tests/integration/test_multiple_consumers.py index f39c9b8..b322688 100644 --- a/tests/integration/test_multiple_consumers.py +++ b/tests/integration/test_multiple_consumers.py @@ -124,6 +124,7 @@ async def make_arequest(url, expected_lines=2): @pytest.mark.skipif(os.name == "nt", reason="Skip on Windows") +@pytest.mark.e2e @pytest.mark.parametrize( ("server_command", "expected_lines"), [