3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +01:00

Revert "test_irc_parsers: fix Python 3.5 support"

This reverts commit 8cf1beb183.
This commit is contained in:
James Lu 2019-10-10 22:55:54 -07:00
parent 8d01eaa5c8
commit 243efbd0f8

View File

@ -4,7 +4,6 @@ Runs IRC parser tests from ircdocs/parser-tests.
This test suite runs static code only. This test suite runs static code only.
""" """
from pathlib import Path from pathlib import Path
import sys
import unittest import unittest
import yaml import yaml
@ -18,20 +17,13 @@ from pylinkirc.protocols.ircs2s_common import IRCCommonProtocol
class MessageParserTest(unittest.TestCase): class MessageParserTest(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
with open(PARSER_DATA_PATH / 'msg-split.yaml') as f:
if sys.version_info >= (3, 6):
_open = open
else:
def _open(f): # Coerse pathlib paths to str for py3.5 compat
return open(str(f))
with _open(PARSER_DATA_PATH / 'msg-split.yaml') as f:
cls.MESSAGE_SPLIT_TEST_DATA = yaml.safe_load(f) cls.MESSAGE_SPLIT_TEST_DATA = yaml.safe_load(f)
with _open(PARSER_DATA_PATH / 'userhost-split.yaml') as f: with open(PARSER_DATA_PATH / 'userhost-split.yaml') as f:
cls.USER_HOST_SPLIT_TEST_DATA = yaml.safe_load(f) cls.USER_HOST_SPLIT_TEST_DATA = yaml.safe_load(f)
with _open(PARSER_DATA_PATH / 'mask-match.yaml') as f: with open(PARSER_DATA_PATH / 'mask-match.yaml') as f:
cls.MASK_MATCH_TEST_DATA = yaml.safe_load(f) cls.MASK_MATCH_TEST_DATA = yaml.safe_load(f)
with _open(PARSER_DATA_PATH / 'validate-hostname.yaml') as f: with open(PARSER_DATA_PATH / 'validate-hostname.yaml') as f:
cls.VALIDATE_HOSTNAME_TEST_DATA = yaml.safe_load(f) cls.VALIDATE_HOSTNAME_TEST_DATA = yaml.safe_load(f)
def testMessageSplit(self): def testMessageSplit(self):