Commit d71fc3b2 by Bryton Lacquement

wip

1 parent 2b6466c0
......@@ -68,18 +68,13 @@ extra_config_dict = {
self.launcher.run()
result = self.getPromiseResult(self.promise_name)
self.assertEqual(result['result']['failed'], True)
if six.PY3:
self.assertEqual(
result['result']['message'],
"ERROR IsADirectoryError(21, 'Is a directory') "
"during opening and reading file %r" % (filename,)
)
else:
self.assertEqual(
result['result']['message'],
"ERROR IOError(21, 'Is a directory') "
"during opening and reading file %r" % (filename,)
)
self.assertEqual(
result['result']['message'],
"ERROR %s(21, 'Is a directory') "
"during opening and reading file %r" % (
"IsADirectoryError" if six.PY3 else "IOError",
filename)
)
def test_check_file_not_exists(self):
filename = os.path.join(self.tempdir, 'test.file')
......@@ -94,18 +89,13 @@ extra_config_dict = {
self.launcher.run()
result = self.getPromiseResult(self.promise_name)
self.assertEqual(result['result']['failed'], True)
if six.PY3:
self.assertEqual(
result['result']['message'],
"ERROR FileNotFoundError(2, 'No such file or directory') "
"during opening and reading file %r" % (filename,)
)
else:
self.assertEqual(
result['result']['message'],
"ERROR IOError(2, 'No such file or directory') "
"during opening and reading file %r" % (filename,)
)
self.assertEqual(
result['result']['message'],
"ERROR %s(2, 'No such file or directory') "
"during opening and reading file %r" % (
"FileNotFoundError" if six.PY3 else "IOError",
filename)
)
def test_check_file_empty(self):
filename = os.path.join(self.tempdir, 'test.file')
......
......@@ -275,16 +275,11 @@ class TestCheckUrlAvailable(CheckUrlAvailableMixin):
self.launcher.run()
result = self.getPromiseResult(self.promise_name)
self.assertEqual(result['result']['failed'], True)
if six.PY3:
self.assertEqual(
result['result']['message'],
"ERROR: Invalid URL 'https://': No host supplied"
)
else:
self.assertEqual(
result['result']['message'],
"ERROR: Invalid URL u'https://': No host supplied"
)
self.assertEqual(
result['result']['message'],
"ERROR: Invalid URL %s'https://': No host supplied" %
('' if six.PY3 else 'u')
)
def test_check_url_malformed(self):
content = self.base_content % {
......
......@@ -159,8 +159,8 @@ class TestAutoSTemp(unittest.TestCase):
removes it when deleted.
"""
f = AutoSTemp("foo")
with open(f.name, "r") as file:
self.assertEqual(file.read(), "foo")
with open(f.name, "r") as f_:
self.assertEqual(f_.read(), "foo")
fname = f.name
self.assertTrue(os.path.isfile(fname))
del f
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!