summaryrefslogtreecommitdiff
path: root/bs4/tests/test_fuzz.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2023-04-05 07:42:21 -0400
committerLeonard Richardson <leonardr@segfault.org>2023-04-05 07:42:21 -0400
commitd5d47d89299be1f251a984d85b92b8b6dc0ea5c6 (patch)
tree24d7e97796617031e3346259db889bf6f02cec58 /bs4/tests/test_fuzz.py
parent8c885083e6a3a8ce69724b14300816f329393071 (diff)
Rename the test case markup files with a .testcase extension so the manifest can be made more strict about what it includes.
Diffstat (limited to 'bs4/tests/test_fuzz.py')
-rw-r--r--bs4/tests/test_fuzz.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bs4/tests/test_fuzz.py b/bs4/tests/test_fuzz.py
index 11a9100..f778539 100644
--- a/bs4/tests/test_fuzz.py
+++ b/bs4/tests/test_fuzz.py
@@ -17,6 +17,10 @@ from bs4 import (
class TestFuzz(object):
+ # Test case markup files from fuzzers are given this extension so
+ # they can be included in builds.
+ TESTCASE_SUFFIX = ".testcase"
+
# This class of error has been fixed by catching a less helpful
# exception from html.parser and raising ParserRejectedMarkup
# instead.
@@ -80,6 +84,8 @@ class TestFuzz(object):
print(BeautifulSoup(markup, 'html5lib').encode())
def __markup(self, filename):
+ if not filename.endswith(self.TESTCASE_SUFFIX):
+ filename += self.TESTCASE_SUFFIX
this_dir = os.path.split(__file__)[0]
path = os.path.join(this_dir, 'fuzz', filename)
return open(path, 'rb').read()