Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Test

on:
schedule:
# run once a month at midnight of the first day of the month
- cron: 0 0 1 * *
workflow_call:
workflow_dispatch: # run manually from actions tab

# Set permissions at the job level.
permissions: {}
Expand Down Expand Up @@ -34,6 +38,9 @@ jobs:
run: just cov
env:
TERM: dumb # keep rich from printing escape sequences, which made testing CLI outputs messy
- name: Run e2e tests
run: just e2e-test
if: matrix.python-version == '3.13'
- name: Generate coverage report
run: |
export TOTAL_COV=$(hatch run cov-total)
Expand Down
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ check: lint typecheck
test:
uv run pytest tests

[group('test')]
e2e-test:
uv run pytest -m e2e

[group('test')]
cov:
uv run pytest --cov=src
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ addopts = [
"--showlocals",
"--strict-markers",
"--strict-config",
"-m not e2e", # default behaviour: do not run e2e tests
]
asyncio_mode = "auto"
filterwarnings = [
Expand All @@ -178,6 +179,9 @@ filterwarnings = [
log_cli_level = "INFO"
xfail_strict = true
testpaths = "tests"
markers = [
"e2e: marks tests as end-to-end tests, requesting the live api",
]

[tool.coverage.run] # Ref: https://coverage.readthedocs.io/en/latest/config.html
branch = true
Expand Down
26 changes: 26 additions & 0 deletions tests/e2e/test_live_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2025 Heinz-Alexander Fütterer
#
# SPDX-License-Identifier: MIT

from __future__ import annotations

import pytest

import re3data
from re3data._resources import Repository, RepositoryName, RepositorySummary

pytestmark = pytest.mark.e2e


def test_get_single_repository(zenodo_id: str) -> None:
response = re3data.repositories.get(zenodo_id)
assert isinstance(response, Repository)
assert response.id == zenodo_id
assert isinstance(response.repository_name, RepositoryName)
assert response.repository_name.value == "Zenodo"


def test_list_repositories_query_string() -> None:
response = re3data.repositories.list(query="biosharing")
assert isinstance(response, list)
assert isinstance(response[0], RepositorySummary)