From 8dab5a8a136c74f998a8ed0894e589bd81a4eb0b Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Wed, 29 Nov 2023 10:39:13 -0800 Subject: [PATCH] make unit tests run without manual opt outs file for aaf115347ec98ddb484d04875c4c1b8fa67ffddd --- common.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common.py b/common.py index 158aa06..afa2cc0 100644 --- a/common.py +++ b/common.py @@ -2,7 +2,7 @@ import base64 from datetime import timedelta import logging -import os +from pathlib import Path import re import threading import urllib.parse @@ -65,8 +65,12 @@ DOMAIN_BLOCKLIST = ( 'twitter.com', ) -with open(os.path.join(os.path.dirname(__file__), 'opt_outs.txt')) as f: - OPT_OUT_IDS = util.load_file_lines(f) +opt_outs = Path(__file__).parent / 'opt_outs.txt' +if opt_outs.exists(): + with opt_outs.open() as f: + OPT_OUT_IDS = util.load_file_lines(f) +else: + OPT_OUT_IDS = {'fake:bridgy-fed:test-opt-out'} # populated in models.reset_protocol_properties SUBDOMAIN_BASE_URL_RE = None