diff --git a/swh/lister/github/tests/conftest.py b/swh/lister/github/tests/conftest.py new file mode 100644 index 0000000..e28927b --- /dev/null +++ b/swh/lister/github/tests/conftest.py @@ -0,0 +1,26 @@ +# Copyright (C) 2019-2020 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU General Public License version 3, or any later version +# See top-level LICENSE file for more information + +import pytest + + +@pytest.fixture +def lister_under_test(): + return "github" + + +@pytest.fixture +def lister_github(swh_lister): + for task_type in [ + { + "type": "load-git", + "description": "Load git repository", + "backend_name": "swh.loader.git.tasks.UpdateGitRepository", + "default_interval": "1 day", + }, + ]: + swh_lister.scheduler.create_task_type(task_type) + + return swh_lister diff --git a/swh/lister/github/tests/test_lister.py b/swh/lister/github/tests/test_lister.py index fef8810..1c0d7b1 100644 --- a/swh/lister/github/tests/test_lister.py +++ b/swh/lister/github/tests/test_lister.py @@ -6,7 +6,6 @@ import re import unittest -import pytest import requests_mock from swh.lister.core.tests.test_lister import HttpListerTester @@ -58,18 +57,13 @@ class GitHubListerTester(HttpListerTester, unittest.TestCase): ) -@pytest.fixture -def lister_under_test(): - return "github" - - -def test_lister_github(swh_lister, requests_mock_datadir): +def test_lister_github(lister_github, requests_mock_datadir): """Simple github listing should create scheduled tasks """ - swh_lister.run() + lister_github.run() - r = swh_lister.scheduler.search_tasks(task_type="load-git") + r = lister_github.scheduler.search_tasks(task_type="load-git") assert len(r) == 100 for row in r: