Add an .excluded_sites list to allow pass tests

pull/403/head
Paulo Diovani 4 years ago
parent c34eb843b6
commit 2e9c700107

3
.gitignore vendored

@ -22,5 +22,8 @@ src/
# Comma-Separated Values (CSV) Reports
*.csv
# Excluded sites list
tests/.excluded_sites
# MacOS Folder Metadata File
.DS_Store

@ -197,6 +197,10 @@ Note that we do currently have 100% test coverage. Unfortunately, some of
the sites that Sherlock checks are not always reliable, so it is common
to get response errors.
If some sites are failing due to conection problems (site is down, in maintainence, etc)
you can exclude them from tests by creating a `tests/.excluded_sites` file with a
list of sites to ignore (one site name per line).
## Stargazers over time
[![Stargazers over time](https://starcharts.herokuapp.com/TheYahya/sherlock.svg)](https://starcharts.herokuapp.com/TheYahya/sherlock)

@ -32,6 +32,14 @@ class SherlockBaseTest(unittest.TestCase):
with open(data_file_path, "r", encoding="utf-8") as raw:
self.site_data_all = json.load(raw)
# Load excluded sites list, if any
excluded_sites_path = os.path.join(os.path.dirname(os.path.realpath(sherlock.__file__)), "tests/.excluded_sites")
try:
with open(excluded_sites_path, "r", encoding="utf-8") as excluded_sites_file:
self.excluded_sites = excluded_sites_file.read().splitlines()
except FileNotFoundError:
self.excluded_sites = []
self.verbose=False
self.tor=False
self.unique_tor=False
@ -134,6 +142,7 @@ class SherlockBaseTest(unittest.TestCase):
for site, site_data in self.site_data_all.items():
if (
(site in self.excluded_sites) or
(site_data["errorType"] != detect_type) or
(site_data.get("username_claimed") is None) or
(site_data.get("username_unclaimed") is None)

Loading…
Cancel
Save