diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index a5a723a1..00a92a23 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -21,13 +21,13 @@ runs: steps: - name: Install uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v8.3.2 with: python-version: ${{ inputs.python-version }} activate-environment: true - name: Cache uv virtual environment - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: .venv key: uv-venv-${{ runner.os }}-py-${{ inputs.python-version }}-cuda-${{ inputs.cuda-version }} @@ -46,7 +46,7 @@ runs: - name: Set up TeX Live if: ${{ inputs.full_install == 'true' }} - uses: TeX-Live/setup-texlive-action@v3 + uses: TeX-Live/setup-texlive-action@v4 with: cache: true packages: | @@ -79,11 +79,8 @@ runs: python3-dev libcairo2-dev libpango1.0-dev + ffmpeg - - name: Install ffmpeg - if: ${{ inputs.full_install == 'true' }} - uses: FedericoCarboni/setup-ffmpeg@v3 - - name: Install optional Python dependencies if: ${{ inputs.full_install == 'true' }} run: | diff --git a/.github/workflows/docstring_testing.yml b/.github/workflows/docstring_testing.yml index 96f71d74..378a2488 100644 --- a/.github/workflows/docstring_testing.yml +++ b/.github/workflows/docstring_testing.yml @@ -18,10 +18,10 @@ jobs: # Only run workflow if certain files have been changed. - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v42 + uses: tj-actions/changed-files@v47 with: files: | - .github/workflows/notebook_testing.yml + .github/workflows/docstring_testing.yml src/** tests/** pyproject.toml diff --git a/.github/workflows/full_testing.yml b/.github/workflows/full_testing.yml index d354035e..17f064a8 100644 --- a/.github/workflows/full_testing.yml +++ b/.github/workflows/full_testing.yml @@ -28,5 +28,13 @@ jobs: - name: Run tests run: | - pytest + pytest -m "not network and not benchmark and not gpu" + shell: bash + + # Tests that depend on reaching external network services (e.g. networks.skewed.de) + # are flaky in CI, so they run separately and don't fail the build. + - name: Run network-dependent tests + continue-on-error: true + run: | + pytest -m network --no-cov shell: bash diff --git a/.github/workflows/notebook_testing.yml b/.github/workflows/notebook_testing.yml index b31b53ec..8f29ac57 100644 --- a/.github/workflows/notebook_testing.yml +++ b/.github/workflows/notebook_testing.yml @@ -18,7 +18,7 @@ jobs: # Only run workflow if certain files have been changed. - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v42 + uses: tj-actions/changed-files@v47 with: files: | .github/workflows/notebook_testing.yml diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b5b40032..43c40b01 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -19,7 +19,7 @@ jobs: # Only run workflow if certain files have been changed. - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v42 + uses: tj-actions/changed-files@v47 with: files: | .github/workflows/testing.yml @@ -34,4 +34,12 @@ jobs: - name: Run tests if: steps.changed-files.outputs.any_changed == 'true' run: | - pytest + pytest -m "not network and not benchmark and not gpu" + + # Tests that depend on reaching external network services (e.g. networks.skewed.de) + # are flaky in CI, so they run separately and don't fail the build. + - name: Run network-dependent tests + if: steps.changed-files.outputs.any_changed == 'true' + continue-on-error: true + run: | + pytest -m network --no-cov diff --git a/pyproject.toml b/pyproject.toml index f9b42646..cb4fa23a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -172,7 +172,8 @@ pythonpath = ["src"] testpaths = "tests" markers = [ "benchmark: marks tests as benchmarking tests (deselect with '-m \"not benchmark\"')", - "gpu: marks tests that require GPU support (deselect with '-m \"not gpu\"')" + "gpu: marks tests that require GPU support (deselect with '-m \"not gpu\"')", + "network: marks tests that depend on reaching an external network service (deselect with '-m \"not network\"')" ] addopts = "--cov=src -m \"not benchmark and not gpu\" --doctest-modules" doctest_optionflags = "ELLIPSIS NORMALIZE_WHITESPACE" diff --git a/tests/io/test_netzschleuder.py b/tests/io/test_netzschleuder.py index 8eb2d64a..02463e16 100644 --- a/tests/io/test_netzschleuder.py +++ b/tests/io/test_netzschleuder.py @@ -7,6 +7,7 @@ from pathpyG.io import list_netzschleuder_records, read_netzschleuder_graph, read_netzschleuder_record +@pytest.mark.network def test_list_netzschleuder_records(): """Test the list_netzschleuder_records() function.""" # Test the function with a valid URL. @@ -20,6 +21,7 @@ def test_list_netzschleuder_records(): records = list_netzschleuder_records(url) +@pytest.mark.network def test_node_attrs(): """Test the extraction of node attributes.""" g = read_netzschleuder_graph("karate", "77") @@ -28,6 +30,7 @@ def test_node_attrs(): assert "node_groups" in g.node_attrs() +@pytest.mark.network def test_edge_attrs(): """Test the extraction of edge attributes.""" # Original edge list: @@ -65,6 +68,7 @@ def test_edge_attrs(): assert (g.data.edge_weight[mask] == weight).all() +@pytest.mark.network def test_graph_attrs(): """Test the extraction of graph attributes.""" g = read_netzschleuder_graph("karate", "77") @@ -72,6 +76,7 @@ def test_graph_attrs(): assert g.data.analyses_diameter == 5 +@pytest.mark.network def test_read_netzschleuder_record(): """Test the read_netzschleuder_record() function.""" # Test the function with a valid URL. @@ -86,6 +91,7 @@ def test_read_netzschleuder_record(): record = read_netzschleuder_record(record_name, url) +@pytest.mark.network def test_read_netzschleuder_graph(): """Test the read_netzschleuder_graph() function for timestamped data.""" g = read_netzschleuder_graph(name="email_company") @@ -94,6 +100,7 @@ def test_read_netzschleuder_graph(): assert g.m == 5784 +@pytest.mark.network def test_read_netzschleuder_graph_temporal(): """Test the read_netzschleuder_graph() function for timestamped data.""" g = read_netzschleuder_graph(name="email_company", time_attr="time", multiedges=True)