Skip to content

Commit

Permalink
Joss fix CI (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosselinSomervilleRoberts authored Jun 10, 2024
1 parent fe73ba1 commit d071adc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Install additional dependencies
run: sudo sh ./install.sh
- name: Run tests
run: pytest --durations=20
run: pytest --durations=20 -s src/image2structure -m "not slow"
env:
TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }}
PERSPECTIVE_API_KEY: ${{ secrets.PERSPECTIVE_API_KEY }}
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,6 @@ Then, install the dependencies and git hook scripts:

To run unit tests:

python -m pytest
python -m pytest -s src/image2structure -m "not slow" # Run all tests except ones using OpenArchives
python -m pytest -s src/image2structure -m "slow" # Run only tests using OpenArchives
python -m pytest -s src/image2structure # Run all tests
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
6 changes: 6 additions & 0 deletions src/image2structure/fetch/test_arxiv_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
from image2structure.fetch.arxiv_fetcher import ArxivFetcher
from image2structure.fetch.fetcher import ScrapeResult, DownloadError

# This test often causes issues in CI dur to 503 error from OpenArchives,
# so it is disabled by default.


class TestArxivFetcher:
def setup_method(self, method):
Expand All @@ -27,14 +30,17 @@ def setup_method(self, method):
def teardown_method(self, method):
shutil.rmtree(self.data_path)

@pytest.mark.slow
def test_scrape_runs(self):
results = self.fetcher.scrape(1)
assert len(results) == 1

@pytest.mark.slow
def test_scrape_count(self):
results = self.fetcher.scrape(18)
assert len(results) == 18

@pytest.mark.slow
def test_download_runs(self):
results = self.fetcher.scrape(1)

Expand Down
2 changes: 2 additions & 0 deletions src/image2structure/test_collect.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dotenv import load_dotenv

import os
import pytest
import shutil

from image2structure.collect import run, get_args_parser, get_runner_from_args
Expand Down Expand Up @@ -42,6 +43,7 @@ def test_webpage(self):
runner: Runner = get_runner_from_args(args)
run(runner, args)

@pytest.mark.slow
def test_latex(self):
args = get_args_parser()[0].parse_args(
[
Expand Down

0 comments on commit d071adc

Please sign in to comment.