summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mailman/rules/tests/data/__init__.py0
-rw-r--r--src/mailman/rules/tests/data/org_domain.txt (renamed from src/mailman/rules/data/org_domain)0
-rw-r--r--src/mailman/rules/tests/test_dmarc.py10
3 files changed, 3 insertions, 7 deletions
diff --git a/src/mailman/rules/tests/data/__init__.py b/src/mailman/rules/tests/data/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/mailman/rules/tests/data/__init__.py
diff --git a/src/mailman/rules/data/org_domain b/src/mailman/rules/tests/data/org_domain.txt
index 4e6f7816e..4e6f7816e 100644
--- a/src/mailman/rules/data/org_domain
+++ b/src/mailman/rules/tests/data/org_domain.txt
diff --git a/src/mailman/rules/tests/test_dmarc.py b/src/mailman/rules/tests/test_dmarc.py
index e24fa29d0..9af3e9347 100644
--- a/src/mailman/rules/tests/test_dmarc.py
+++ b/src/mailman/rules/tests/test_dmarc.py
@@ -18,8 +18,6 @@
"""Provides support for mocking dnspython calls from dmarc rules and some
organizational domain tests."""
-import os
-
from contextlib import ExitStack
from dns.exception import DNSException
from dns.rdatatype import TXT
@@ -30,6 +28,7 @@ from mailman.rules import dmarc
from mailman.testing.helpers import (
LogFileMark, specialized_message_from_string as mfs)
from mailman.testing.layers import ConfigLayer
+from pkg_resources import resource_filename
from public import public
from unittest import TestCase
from unittest.mock import patch
@@ -103,11 +102,8 @@ def get_org_data():
test data.
"""
def ouropen(url):
- datapath = os.path.join(
- os.path.split(dmarc.__file__)[0],
- 'data',
- 'org_domain',
- )
+ datapath = resource_filename(
+ 'mailman.rules.tests.data', 'org_domain.txt')
org_data_url = 'file:///{}'.format(datapath)
return urlopen(org_data_url)
return patch('mailman.rules.dmarc.request.urlopen', ouropen)