From 8bae1fd54dfed1e911d51973ca070b5bfe8c7ca3 Mon Sep 17 00:00:00 2001 From: Makyen Date: Fri, 15 Nov 2024 15:20:56 -0800 Subject: [PATCH] initialize DNS, per config file, in CI testing for some tests blacklists chatcommands findspam spamhandling autopull --- test/test_blacklists.py | 4 +++- test/test_chatcommands.py | 3 +++ test/test_findspam.py | 4 +++- test/test_spamhandling.py | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/test_blacklists.py b/test/test_blacklists.py index ca803ebca72..76386490035 100755 --- a/test/test_blacklists.py +++ b/test/test_blacklists.py @@ -9,12 +9,14 @@ import pytest from blacklists import Blacklist, YAMLParserCIDR, YAMLParserASN, YAMLParserNS, load_blacklists -from helpers import files_changed, blacklist_integrity_check, not_regex_search_ascii_and_unicode +from helpers import files_changed, blacklist_integrity_check, not_regex_search_ascii_and_unicode, initiate_dns from phone_numbers import NUMBER_REGEX, NUMBER_REGEX_START, NUMBER_REGEX_END, NUMBER_REGEX_MINIMUM_DIGITS, NUMBER_REGEX_MAXIMUM_DIGITS, \ process_numlist, get_maybe_north_american_not_in_normalized_but_in_all, is_digit_count_in_number_regex_range, matches_number_regex, \ matches_number_regex_start, matches_number_regex_end from findspam import FindSpam +initiate_dns() + def test_number_lists(): errors = {} diff --git a/test/test_chatcommands.py b/test/test_chatcommands.py index af2ac8bf64b..4708463dc41 100644 --- a/test/test_chatcommands.py +++ b/test/test_chatcommands.py @@ -19,10 +19,13 @@ from _Git_Windows import git else: from sh.contrib import git +from helpers import initiate_dns from fake import Fake from unittest.mock import patch +initiate_dns() + def rewrap_for_paramiterized_test_bisect(): def decorator(func): diff --git a/test/test_findspam.py b/test/test_findspam.py index 17fc5932a86..3c9a837bf53 100644 --- a/test/test_findspam.py +++ b/test/test_findspam.py @@ -2,7 +2,9 @@ from findspam import FindSpam, ip_for_url_host, get_ns_ips import pytest from classes import Post -from helpers import log +from helpers import log, initiate_dns + +initiate_dns() # noinspection PyMissingTypeHints diff --git a/test/test_spamhandling.py b/test/test_spamhandling.py index 7f64e27c465..27cea8f77fd 100644 --- a/test/test_spamhandling.py +++ b/test/test_spamhandling.py @@ -11,8 +11,10 @@ from unittest.mock import MagicMock, call, ANY, DEFAULT import chatcommunicate from globalvars import GlobalVars +from helpers import initiate_dns +initiate_dns() load_blacklists() test_data_inputs = [] with open("test/data_test_spamhandling.txt", "r", encoding="utf-8") as f: