Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions splunklib/searchcommands/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ def __call__(self, value):
try:
return Code.object(compile(value, 'string', self._mode), six.text_type(value))
except (SyntaxError, TypeError) as error:
if six.PY2:
message = error.message
else:
message = str(error)
message = str(error)

six.raise_from(ValueError(message), error)

Expand Down
11 changes: 7 additions & 4 deletions tests/searchcommands/test_search_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_process_scpv1(self):
result = BytesIO()

self.assertRaises(SystemExit, command.process, argv, ofile=result)
self.assertRegexpMatches(result.getvalue().decode('UTF-8'), expected)
six.assertRegex(self, result.getvalue().decode('UTF-8'), expected)

# TestCommand.process should return configuration settings on Getinfo probe

Expand Down Expand Up @@ -294,7 +294,8 @@ def test_process_scpv1(self):
command.process(argv, ifile, ofile=result)
except SystemExit as error:
self.assertNotEqual(error.code, 0)
self.assertRegexpMatches(
six.assertRegex(
self,
result.getvalue().decode('UTF-8'),
r'^error_message=RuntimeError at ".+", line \d+ : Testing\r\n\r\n$')
except BaseException as error:
Expand All @@ -318,7 +319,8 @@ def test_process_scpv1(self):
except BaseException as error:
self.fail('Expected no exception, but caught {}: {}'.format(type(error).__name__, error))
else:
self.assertRegexpMatches(
six.assertRegex(
self,
result.getvalue().decode('UTF-8'),
r'^\r\n'
r'('
Expand Down Expand Up @@ -705,7 +707,8 @@ def test_process_scpv2(self):
r'logging_configuration=\\\".+\\\" logging_level=\\\"WARNING\\\" record=\\\"f\\\" ' \
r'required_option_1=\\\"value_1\\\" required_option_2=\\\"value_2\\\" show_configuration=\\\"f\\\"\"\]\]\}'

self.assertRegexpMatches(
six.assertRegex(
self,
result.getvalue().decode('utf-8'),
r'^chunked 1.0,2,0\n'
r'\{\}\n'
Expand Down
4 changes: 2 additions & 2 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_handlers(self):
result = run(
"handlers/handlers_certs.py --ca_file=handlers/cacert.bad.pem",
stderr=PIPE)
self.assertNotEquals(result, 0)
self.assertNotEqual(result, 0)

# The proxy handler example requires that there be a proxy available
# to relay requests, so we spin up a local proxy using the proxy
Expand All @@ -171,7 +171,7 @@ def test_handlers(self):
# Run it again without the proxy and it should fail.
result = run(
"handlers/handler_proxy.py --proxy=localhost:80801", stderr=PIPE)
self.assertNotEquals(result, 0)
self.assertNotEqual(result, 0)

def test_index(self):
self.check_commands(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def test_login_and_store_cookie(self):
self.assertEqual(len(self.service.get_cookies()), 0)
self.service.login()
self.assertIsNotNone(self.service.get_cookies())
self.assertNotEquals(self.service.get_cookies(), {})
self.assertNotEqual(self.service.get_cookies(), {})
self.assertEqual(len(self.service.get_cookies()), 1)

def test_login_with_cookie(self):
Expand Down