Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip test case on Windows because Python doesn't yield the ValueError #194

Merged
merged 3 commits into from Jun 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/general.py
Expand Up @@ -811,6 +811,9 @@ def test_process_syntax_error(self):
self.assertEmpty(proc_res.text)
self.assertEmpty(proc_res.bps)

# This test is ignored on Windows for now because it does not yield the value error that other
# platforms do.
@VerminTest.skipPlatform("win32")
def test_process_value_error(self):
# (Py3) ValueError: source code string cannot contain null bytes
# (Py2) TypeError: compile() expected string without null bytes
Expand Down
11 changes: 11 additions & 0 deletions tests/testutils.py
Expand Up @@ -86,6 +86,17 @@ def wrapper(self, *args, **kwargs):
return wrapper
return decorator

@staticmethod
def skipPlatform(platform):
"""Decorator that runs test if executing not on specified platform. It checks that the platform
starts with the provided value, like 'win32' or 'darwin'."""
def decorator(func):
def wrapper(self, *args, **kwargs):
if not sys.platform.lower().startswith(platform.strip().lower()):
func(self, *args, **kwargs)
return wrapper
return decorator

@staticmethod
def parameterized_args(tuple_args):
"""Decorator accepting a list of tuples of arguments."""
Expand Down
11 changes: 11 additions & 0 deletions vermin/processor.py
Expand Up @@ -18,6 +18,17 @@ def __init__(self, path):
# Potential generic/literal annotations used.
self.maybe_annotations = False

def __repr__(self):
return """{} at 0x{:x}
path={}
node={}
mins={}
text={}
novermin={}
bps={}
maybe_annotations={}""".format(self.__class__.__name__, id(self), self.path, self.node, self.mins,
self.text, self.novermin, self.bps, self.maybe_annotations)

# NOTE: This function isn't in the Processor class because Python 2's multiprocessing.pool doesn't
# like it being an instance method:
#
Expand Down