mirror of
https://github.com/progval/irctest.git
synced 2025-04-05 06:49:47 +00:00
Add a 'services' mark, to allow disabling tests that depend on them.
This commit is contained in:
@ -57,6 +57,7 @@ CHANNEL_JOIN_FAIL_NUMERICS = frozenset(
|
||||
|
||||
# typevar for decorators
|
||||
TCallable = TypeVar("TCallable", bound=Callable)
|
||||
TClass = TypeVar("TClass", bound=Type)
|
||||
|
||||
# typevar for the client name used by tests (usually int or str)
|
||||
TClientName = TypeVar("TClientName", bound=Union[Hashable, int])
|
||||
@ -716,6 +717,11 @@ class OptionalityHelper(Generic[TController]):
|
||||
return newf
|
||||
|
||||
|
||||
def mark_services(cls: TClass) -> TClass:
|
||||
cls.run_services = True
|
||||
return pytest.mark.services(cls) # type: ignore
|
||||
|
||||
|
||||
def mark_specifications(
|
||||
*specifications_str: str, deprecated: bool = False, strict: bool = False
|
||||
) -> Callable[[TCallable], TCallable]:
|
||||
|
@ -5,9 +5,8 @@
|
||||
from irctest import cases
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
run_services = True
|
||||
|
||||
def connectRegisteredClient(self, nick):
|
||||
self.addClient()
|
||||
self.sendLine(2, "CAP LS 302")
|
||||
|
@ -4,9 +4,8 @@ from irctest.numerics import ERR_NICKNAMEINUSE, RPL_WELCOME
|
||||
from irctest.patma import ANYSTR, StrRe
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class Bouncer(cases.BaseServerTestCase):
|
||||
run_services = True
|
||||
|
||||
@cases.mark_specifications("Ergo")
|
||||
def testBouncer(self):
|
||||
"""Test basic bouncer functionality."""
|
||||
|
@ -146,7 +146,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
enabled_caps = set(cap_list.params[2].split())
|
||||
enabled_caps.discard("cap-notify") # implicitly added by some impls
|
||||
self.assertEqual(enabled_caps, {cap1, cap2})
|
||||
self.assertIn("time", cap_list.tags)
|
||||
self.assertIn("time", cap_list.tags, cap_list)
|
||||
|
||||
# remove the server-time cap
|
||||
self.sendLine(1, f"CAP REQ :-{cap2}")
|
||||
|
@ -1180,9 +1180,8 @@ class ModeratedMode(cases.BaseServerTestCase):
|
||||
)
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class RegisteredOnlySpeakMode(cases.BaseServerTestCase):
|
||||
run_services = True
|
||||
|
||||
@cases.mark_specifications("Ergo")
|
||||
def testRegisteredOnlySpeakMode(self):
|
||||
self.controller.registerUser(self, "evan", "sesame")
|
||||
|
@ -33,9 +33,8 @@ def validate_chathistory_batch(msgs):
|
||||
return result
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class ChathistoryTestCase(cases.BaseServerTestCase):
|
||||
run_services = True
|
||||
|
||||
@staticmethod
|
||||
def config() -> cases.TestCaseControllerConfig:
|
||||
return cases.TestCaseControllerConfig(chathistory=True)
|
||||
|
@ -2,9 +2,8 @@ from irctest import cases
|
||||
from irctest.numerics import ERR_NICKNAMEINUSE, RPL_WELCOME
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class ConfusablesTestCase(cases.BaseServerTestCase):
|
||||
run_services = True
|
||||
|
||||
@staticmethod
|
||||
def config() -> cases.TestCaseControllerConfig:
|
||||
return cases.TestCaseControllerConfig(
|
||||
|
@ -5,9 +5,8 @@
|
||||
from irctest import cases
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class MetadataTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
run_services = True
|
||||
|
||||
def connectRegisteredClient(self, nick):
|
||||
self.addClient()
|
||||
self.sendLine(2, "CAP LS 302")
|
||||
|
@ -4,16 +4,14 @@ from irctest import cases
|
||||
from irctest.patma import ANYSTR
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class RegistrationTestCase(cases.BaseServerTestCase):
|
||||
run_services = True
|
||||
|
||||
def testRegistration(self):
|
||||
self.controller.registerUser(self, "testuser", "mypassword")
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
run_services = True
|
||||
|
||||
@cases.mark_specifications("IRCv3")
|
||||
@cases.OptionalityHelper.skipUnlessHasMechanism("PLAIN")
|
||||
def testPlain(self):
|
||||
|
@ -13,9 +13,8 @@ from irctest.numerics import (
|
||||
)
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class WhoisTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
run_services = True
|
||||
|
||||
@cases.mark_specifications("RFC2812")
|
||||
def testWhoisUser(self):
|
||||
"""Test basic WHOIS behavior"""
|
||||
|
@ -13,9 +13,8 @@ def extract_playback_privmsgs(messages):
|
||||
return result
|
||||
|
||||
|
||||
@cases.mark_services
|
||||
class ZncPlaybackTestCase(cases.BaseServerTestCase):
|
||||
run_services = True
|
||||
|
||||
@staticmethod
|
||||
def config() -> cases.TestCaseControllerConfig:
|
||||
return cases.TestCaseControllerConfig(chathistory=True)
|
||||
|
@ -11,6 +11,7 @@ markers =
|
||||
# misc marks
|
||||
strict
|
||||
deprecated
|
||||
services
|
||||
|
||||
# capabilities
|
||||
account-tag
|
||||
|
Reference in New Issue
Block a user