Browse Source

Add an .excluded_sites list to allow pass tests

pull/403/head
Paulo Diovani 8 months ago
parent
commit
2e9c700107
3 changed files with 16 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +4
    -0
      README.md
  3. +9
    -0
      tests/base.py

+ 3
- 0
.gitignore View File

@@ -22,5 +22,8 @@ src/
# Comma-Separated Values (CSV) Reports
*.csv

# Excluded sites list
tests/.excluded_sites

# MacOS Folder Metadata File
.DS_Store

+ 4
- 0
README.md View File

@@ -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)


+ 9
- 0
tests/base.py View File

@@ -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