From 0652f53b507bf1fb9219c06ad3e053714e75c4c0 Mon Sep 17 00:00:00 2001 From: Serene-Arc Date: Fri, 26 Feb 2021 19:09:25 +1000 Subject: [PATCH] Mark online tests --- bulkredditdownloader/tests/downloaders/test_gallery.py | 1 + bulkredditdownloader/tests/test_file_name_formatter.py | 4 +++- pytest.ini | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 pytest.ini diff --git a/bulkredditdownloader/tests/downloaders/test_gallery.py b/bulkredditdownloader/tests/downloaders/test_gallery.py index 11a0651..aa8a57e 100644 --- a/bulkredditdownloader/tests/downloaders/test_gallery.py +++ b/bulkredditdownloader/tests/downloaders/test_gallery.py @@ -13,6 +13,7 @@ def reddit_submission(reddit_instance) -> praw.models.Submission: return reddit_instance.submission(id='ljyy27') +@pytest.mark.online def test_gallery(reddit_submission: praw.models.Submission): gallery = Gallery(reddit_submission) results = gallery.find_resources() diff --git a/bulkredditdownloader/tests/test_file_name_formatter.py b/bulkredditdownloader/tests/test_file_name_formatter.py index d884cb4..abe67ae 100644 --- a/bulkredditdownloader/tests/test_file_name_formatter.py +++ b/bulkredditdownloader/tests/test_file_name_formatter.py @@ -42,6 +42,7 @@ def test_format_name_mock(format_string: str, expected: str, submission: Mock): assert result == expected +@pytest.mark.online @pytest.mark.parametrize(('format_string', 'expected'), (('{SUBREDDIT}', 'Mindustry'), ('{REDDITOR}', 'Gamer_player_boi'), @@ -55,6 +56,7 @@ def test_format_name_real(format_string: str, expected: str, reddit_submission: assert result == expected +@pytest.mark.online @pytest.mark.parametrize(('format_string_directory', 'format_string_file', 'expected'), (('{SUBREDDIT}', '{POSTID}', 'test/Mindustry/lgilgt.png'), ('{SUBREDDIT}', '{TITLE}_{POSTID}', @@ -67,7 +69,7 @@ def test_format_full( format_string_file: str, expected: str, reddit_submission: praw.models.Submission): - test_resource = Resource(reddit_submission, 'i.reddit.com/blabla.png', b'') + test_resource = Resource(reddit_submission, 'i.reddit.com/blabla.png') test_formatter = FileNameFormatter(format_string_file, format_string_directory) result = test_formatter.format_path(test_resource, Path('test')) assert str(result) == expected diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..ccd0a19 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +markers = + online: tests require a connection to the internet \ No newline at end of file