diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2012-04-30 22:46:00 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2012-04-30 22:46:00 -0400 |
commit | ceeccea33a8e4e425425e4ed30c0ed2c34b67bbe (patch) | |
tree | a1e735f0815130297304fc0d9a432afd043ab633 | |
parent | cf13872f382961729c922b6852f522364b167099 (diff) | |
download | passlib-ceeccea33a8e4e425425e4ed30c0ed2c34b67bbe.tar.gz |
excluded some branches from coverage
-rw-r--r-- | passlib/apache.py | 6 | ||||
-rw-r--r-- | passlib/context.py | 24 | ||||
-rw-r--r-- | passlib/ext/django/models.py | 4 | ||||
-rw-r--r-- | passlib/hosts.py | 2 | ||||
-rw-r--r-- | passlib/ifc.py | 14 | ||||
-rw-r--r-- | passlib/utils/__init__.py | 4 | ||||
-rw-r--r-- | passlib/utils/des.py | 6 | ||||
-rw-r--r-- | passlib/utils/md4.py | 7 |
8 files changed, 33 insertions, 34 deletions
diff --git a/passlib/apache.py b/passlib/apache.py index b1c4a47..f2d87e6 100644 --- a/passlib/apache.py +++ b/passlib/apache.py @@ -270,7 +270,7 @@ class _CommonFile(object): if key not in records: records[key] = value - def _parse_record(cls, record, lineno): + def _parse_record(cls, record, lineno): # pragma: no cover - abstract method "parse line of file into (key, value) pair" raise NotImplementedError("should be implemented in subclass") @@ -304,7 +304,7 @@ class _CommonFile(object): "iterator yielding lines of database" return (self._render_record(key,value) for key,value in iteritems(self._records)) - def _render_record(cls, key, value): + def _render_record(cls, key, value): # pragma: no cover - abstract method "given key/value pair, encode as line of file" raise NotImplementedError("should be implemented in subclass") @@ -315,7 +315,7 @@ class _CommonFile(object): "user-specific wrapper for _encode_field()" return self._encode_field(user, "user") - def _encode_realm(self, realm): + def _encode_realm(self, realm): # pragma: no cover - abstract method "realm-specific wrapper for _encode_field()" return self._encode_field(realm, "realm") diff --git a/passlib/context.py b/passlib/context.py index d32a5cd..8e936c8 100644 --- a/passlib/context.py +++ b/passlib/context.py @@ -257,7 +257,7 @@ class CryptPolicy(object): :meth:`CryptContext.copy` instead. """ if self._stub_policy: - warn(_preamble + + warn(_preamble + # pragma: no cover -- deprecated & unused "Instead of ``context.policy.replace()``, " "use ``context.update()`` or ``context.copy()``.", DeprecationWarning, stacklevel=2) @@ -322,7 +322,7 @@ class CryptPolicy(object): see :meth:`CryptContext.schemes`. """ if self._stub_policy: - warn(_preamble + + warn(_preamble + # pragma: no cover -- deprecated & unused "Instead of ``context.policy.has_schemes()``, " "use ``bool(context.schemes())``.", DeprecationWarning, stacklevel=2) @@ -361,7 +361,7 @@ class CryptPolicy(object): applications should use :meth:`CryptContext.schemes` instead. """ if self._stub_policy: - warn(_preamble + + warn(_preamble + # pragma: no cover -- deprecated & unused "Instead of ``context.policy.schemes()``, " "use ``context.schemes()``.", DeprecationWarning, stacklevel=2) @@ -429,7 +429,7 @@ class CryptPolicy(object): """ # XXX: might make a public replacement, but need more study of the use cases. if self._stub_policy: - warn(_preamble + + warn(_preamble + # pragma: no cover -- deprecated & unused "``context.policy.get_options()`` will no longer be available.", DeprecationWarning, stacklevel=2) else: @@ -472,7 +472,7 @@ class CryptPolicy(object): applications should use :meth:`CryptContext.to_dict` instead. """ if self._stub_policy: - warn(_preamble + + warn(_preamble + # pragma: no cover -- deprecated & unused "Instead of ``context.policy.iter_config()``, " "use ``context.to_dict().items()``.", DeprecationWarning, stacklevel=2) @@ -520,7 +520,7 @@ class CryptPolicy(object): DeprecationWarning, stacklevel=2) return self._context.to_dict(resolve) - def to_file(self, stream, section="passlib"): + def to_file(self, stream, section="passlib"): # pragma: no cover -- deprecated & unused """export policy to file. .. deprecated:: 1.6 @@ -550,7 +550,7 @@ class CryptPolicy(object): applications should use :meth:`CryptContext.to_string` instead. """ if self._stub_policy: - warn(_preamble + + warn(_preamble + # pragma: no cover -- deprecated & unused "Instead of ``context.policy.to_string()``, " "use ``context.to_string()``.", DeprecationWarning, stacklevel=2) @@ -655,7 +655,7 @@ class _CryptRecord(object): else: return "%s config" % (handler.name,) - def __repr__(self): + def __repr__(self): # pragma: no cover -- debugging return "<_CryptRecord 0x%x for %s>" % (id(self), self._errprefix) #================================================================ @@ -948,9 +948,9 @@ class _CryptRecord(object): hash_obj = self.handler.from_string(hash) try: rounds = hash_obj.rounds - except AttributeError: - # XXX: hash_obj should generally have rounds attr, - # so should a warning be raised here? + except AttributeError: # pragma: no cover -- sanity check + # XXX: all builtin hashes should have rounds attr, + # so should a warning be issues here? pass else: mn = self._min_rounds @@ -1800,7 +1800,7 @@ class CryptContext(object): for handler in self._handlers: if handler.name == scheme: return handler - raise AssertionError("failed to find matching handler") + raise AssertionError("failed to find matching handler") # pragma: no cover -- sanity check defaults = self._default_schemes if defaults: try: diff --git a/passlib/ext/django/models.py b/passlib/ext/django/models.py index eb82143..55bb4c6 100644 --- a/passlib/ext/django/models.py +++ b/passlib/ext/django/models.py @@ -207,7 +207,7 @@ def _remove_patch(): _patched = False log.debug("...finished removing django monkeypatching") return True - if _manager: + if _manager: # pragma: no cover -- sanity check log.warning("reverting partial monkeypatching of django...") _manager.unpatch_all() password_context.load({}) @@ -253,7 +253,7 @@ def _load(): # check if we've been disabled if config == "disabled": - if _patched: + if _patched: # pragma: no cover -- sanity check log.error("didn't expect monkeypatching would be applied!") _remove_patch() return diff --git a/passlib/hosts.py b/passlib/hosts.py index dc3ce83..2594296 100644 --- a/passlib/hosts.py +++ b/passlib/hosts.py @@ -82,7 +82,7 @@ if has_crypt: # only offer disabled handler if there's another scheme in front, # as this can't actually hash any passwords yield "unix_disabled" - else: # pragma: no cover + else: # pragma: no cover -- sanity check # no idea what OS this could happen on... warn("crypt.crypt() function is present, but doesn't support any " "formats known to passlib!", PasslibRuntimeWarning) diff --git a/passlib/ifc.py b/passlib/ifc.py index 8d9d49f..79911fb 100644 --- a/passlib/ifc.py +++ b/passlib/ifc.py @@ -22,8 +22,8 @@ else: ABCMeta = type def abstractmethod(func): return func - def abstractproperty(): - return None +# def abstractproperty(): +# return None def create_with_metaclass(meta): "class decorator that re-creates class using metaclass" @@ -83,13 +83,13 @@ class PasswordHash(object): #===================================================== @classmethod @abstractmethod - def encrypt(cls, secret, **setting_and_context_kwds): + def encrypt(cls, secret, **setting_and_context_kwds): # pragma: no cover -- abstract method "encrypt secret, returning resulting hash" raise NotImplementedError("must be implemented by subclass") @classmethod @abstractmethod - def verify(cls, secret, hash, **context_kwds): + def verify(cls, secret, hash, **context_kwds): # pragma: no cover -- abstract method "verify secret against hash, returns True/False" raise NotImplementedError("must be implemented by subclass") @@ -98,19 +98,19 @@ class PasswordHash(object): #===================================================== @classmethod @abstractmethod - def identify(cls, hash): + def identify(cls, hash): # pragma: no cover -- abstract method "check if hash belongs to this scheme, returns True/False" raise NotImplementedError("must be implemented by subclass") @classmethod @abstractmethod - def genconfig(cls, **setting_kwds): + def genconfig(cls, **setting_kwds): # pragma: no cover -- abstract method "compile settings into a configuration string for genhash()" raise NotImplementedError("must be implemented by subclass") @classmethod @abstractmethod - def genhash(cls, secret, config, **context_kwds): + def genhash(cls, secret, config, **context_kwds): # pragma: no cover -- abstract method "generated hash for secret, using settings from config/hash string" raise NotImplementedError("must be implemented by subclass") diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py index fc90055..4e29259 100644 --- a/passlib/utils/__init__.py +++ b/passlib/utils/__init__.py @@ -473,7 +473,7 @@ def saslprep(source, param="value"): return data # replace saslprep() with stub when stringprep is missing -if stringprep is None: +if stringprep is None: # pragma: no cover -- runtime detection def saslprep(source, param="value"): "stub for saslprep()" raise NotImplementedError("saslprep() support requires the 'stringprep' " @@ -669,7 +669,7 @@ add_doc(to_native_str, """) @deprecated_function(deprecated="1.6", removed="1.7") -def to_hash_str(source, encoding="ascii"): # pragma: no cover +def to_hash_str(source, encoding="ascii"): # pragma: no cover -- deprecated & unused "deprecated, use to_native_str() instead" return to_native_str(source, encoding, param="hash") diff --git a/passlib/utils/des.py b/passlib/utils/des.py index 25f1d0d..f21de4d 100644 --- a/passlib/utils/des.py +++ b/passlib/utils/des.py @@ -844,9 +844,9 @@ def des_encrypt_int_block(key, input, salt=0, rounds=1): ) return _permute(C, CF6464) -def mdes_encrypt_int_block(key, input, salt=0, rounds=1): # pragma: no cover - warn("mdes_encrypt_int_block() has been deprecated as of Passlib 1.6," - "and will be removed in Passlib 1.8, use des_encrypt_int_block instead.") +@deprecated_function(deprecated="1.6", removed="1.8", + replacement="des_encrypt_int_block()") +def mdes_encrypt_int_block(key, input, salt=0, rounds=1): # pragma: no cover -- deprecated & unused if isinstance(key, bytes): if len(key) == 7: key = expand_des_key(key) diff --git a/passlib/utils/md4.py b/passlib/utils/md4.py index 2dd6da9..63f0d1b 100644 --- a/passlib/utils/md4.py +++ b/passlib/utils/md4.py @@ -238,7 +238,7 @@ _builtin_md4 = md4 import hashlib from passlib.utils import PYPY -def _has_native_md4(): +def _has_native_md4(): # pragma: no cover -- runtime detection try: h = hashlib.new("md4") except ValueError: @@ -250,10 +250,9 @@ def _has_native_md4(): if PYPY and result == '': # workaround for https://bugs.pypy.org/issue957, fixed in PyPy 1.8 return False - #anything else should alert user + # anything else and we should alert user from passlib.exc import PasslibRuntimeWarning - warn("native md4 support disabled, incorrect value returned!", - PasslibRuntimeWarning) + warn("native md4 support disabled, sanity check failed!", PasslibRuntimeWarning) return False if _has_native_md4(): |