diff --git a/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini b/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini index 5fd7bf6a6..a553bdc6e 100644 --- a/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini +++ b/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini @@ -193,8 +193,6 @@ NotParallelSafe=true # Uses a temporary module with a fixed name [IronPython.modules.misc.test__weakref] RetryCount=2 -[IronPython.modules.misc.test_zlib] - [IronPython.modules.system_related.test_nt] RunCondition=NOT $(IS_POSIX) NotParallelSafe=true # Uses fixed file, directory, and environment variable names diff --git a/tests/suite/interop/net/field/test_field_misc.py b/tests/suite/interop/net/field/test_field_misc.py index 2fb8a8b27..df8c78511 100644 --- a/tests/suite/interop/net/field/test_field_misc.py +++ b/tests/suite/interop/net/field/test_field_misc.py @@ -25,9 +25,9 @@ def test_accessibility(self): self.assertIn('ProtectedField', dir(o)) with self.assertRaises(TypeError): hasattr(o, 'ProtectedField') - self.assertRaisesRegexp(AttributeError, "'Misc' object has no attribute 'PrivateField'", lambda: o.PrivateField) + self.assertRaisesRegex(AttributeError, "'Misc' object has no attribute 'PrivateField'", lambda: o.PrivateField) self.assertEqual(o.InterfaceField.PublicStaticField, 500) - + o = DerivedMisc() o.Set() self.assertEqual(o.PublicField, 400) diff --git a/tests/suite/interop/net/type/test___clrtype.py b/tests/suite/interop/net/type/test___clrtype.py index 1fb4a11aa..a8fac713b 100644 --- a/tests/suite/interop/net/type/test___clrtype.py +++ b/tests/suite/interop/net/type/test___clrtype.py @@ -529,7 +529,7 @@ class X(object, metaclass=MyType): #Shouldn't be able to use non-UInt64s try: x.NOT_SO_DYNAMIC = "0" - Fail("TypeError should have been thrown!") + self.fail("TypeError should have been thrown!") except TypeError as e: self.assertEqual(str(e), "expected UInt64, got str") @@ -710,7 +710,7 @@ def __clrtype__(self, stuff): try: class X(object, metaclass=MyType): pass - Fail("Bad __clrtype__ signature!") + self.fail("Bad __clrtype__ signature!") except TypeError as e: self.assertEqual(str(e), @@ -748,7 +748,7 @@ def __clrtype__(self): try: class X(object, metaclass=MyType): pass - Fail("Arbitrary return values of __clrtype__ should not be allowed: " + str(x)) + self.fail("Arbitrary return values of __clrtype__ should not be allowed: " + str(x)) except TypeError as e: self.assertEqual(str(e), expected_msg) @@ -768,7 +768,7 @@ def __clrtype__(self): try: class X(object, metaclass=MyType): pass - Fail("Arbitrary return values of __clrtype__ are not allowed: ", + str(x)) + self.fail("Arbitrary return values of __clrtype__ are not allowed: ", + str(x)) except ValueError as e: self.assertEqual(str(e), "__clrtype__ must return a type, not None") finally: diff --git a/tests/suite/modules/io_related/test_cPickle.py b/tests/suite/modules/io_related/test_cPickle.py index 8d200b41c..da98a63ed 100644 --- a/tests/suite/modules/io_related/test_cPickle.py +++ b/tests/suite/modules/io_related/test_cPickle.py @@ -718,7 +718,7 @@ def test_cp945(self): #--sanity try: x = 1/0 - Fail("should have been division by zero error") + self.fail("should have been division by zero error") except Exception as e: ex = e diff --git a/tests/suite/modules/io_related/test_copyreg.py b/tests/suite/modules/io_related/test_copyreg.py index 633acaad6..ea5e5390e 100644 --- a/tests/suite/modules/io_related/test_copyreg.py +++ b/tests/suite/modules/io_related/test_copyreg.py @@ -173,11 +173,11 @@ def test_extension_cache(self): "The get and set of the attribute failed") if 'cache1' not in copyreg._extension_cache or 'cache2' not in copyreg._extension_cache: - Fail("Set of the attribute failed") + self.fail("Set of the attribute failed") copyreg.clear_extension_cache() if 'cache1' in copyreg._extension_cache or 'cache2' in copyreg._extension_cache: - Fail("The method clear_extension_cache did not work correctly ") + self.fail("The method clear_extension_cache did not work correctly ") def test_reconstructor(self): reconstructor_copy = copyreg._reconstructor diff --git a/tests/suite/modules/misc/test_operator.py b/tests/suite/modules/misc/test_operator.py index ab083d794..8c4db2aa4 100644 --- a/tests/suite/modules/misc/test_operator.py +++ b/tests/suite/modules/misc/test_operator.py @@ -4,6 +4,7 @@ import operator import unittest +import sys from iptest import IronPythonTestCase, is_cli, is_netcoreapp, big, run_test, skipUnlessIronPython @@ -276,7 +277,7 @@ def pow(a,b): return a ** b r = fnc(a,b) except: (exc_type, exc_value, exc_traceback) = sys.exc_info() - Fail("Binary operator failed: %s, %s: %s %s %s (Message=%s)" % (type(a).__name__, type(b).__name__, str(a), sym, str(b), str(exc_value))) + self.fail("Binary operator failed: %s, %s: %s %s %s (Message=%s)" % (type(a).__name__, type(b).__name__, str(a), sym, str(b), str(exc_value))) threes = [ 3, big(3), 3.0 ] zeroes = [ 0, big(0), 0.0 ] @@ -294,7 +295,7 @@ def pow(a,b): return a ** b pass else: (exc_type, exc_value, exc_traceback) = sys.exc_info() - Fail("Didn't get ZeroDivisionError %s, %s, %s, %s, %s (Message=%s)" % (str(func), type(i).__name__, type(j).__name__, str(i), str(j), str(exc_value))) + self.fail("Didn't get ZeroDivisionError %s, %s, %s, %s, %s (Message=%s)" % (str(func), type(i).__name__, type(j).__name__, str(i), str(j), str(exc_value))) def test_unary_ops(self): if is_cli: diff --git a/tests/suite/test_class.py b/tests/suite/test_class.py index 1eb66e117..870910f54 100644 --- a/tests/suite/test_class.py +++ b/tests/suite/test_class.py @@ -2167,7 +2167,7 @@ def __getattr__(self, name): raise AttributeError('catch me') y = x.throws except AttributeError as ex: self.assertEqual(ex.args, ('catch me',)) - else: Fail("should have thrown") + else: self.fail("should have thrown") def test_descriptor_meta_magic(self): class valueDescriptor(object): diff --git a/tests/suite/test_metaclass.py b/tests/suite/test_metaclass.py index 4a2b7bc6e..8e6a83517 100644 --- a/tests/suite/test_metaclass.py +++ b/tests/suite/test_metaclass.py @@ -133,7 +133,7 @@ class D(C): pass class D(C1, metaclass=dash_attributes): pass except TypeError: pass - else: Fail("metaclass conflict expected") + else: self.fail("metaclass conflict expected") class D(C2, metaclass=dash_attributes): def StartSomethingToday(self): pass diff --git a/tests/suite/test_python26.py b/tests/suite/test_python26.py index 727dac794..941f18396 100644 --- a/tests/suite/test_python26.py +++ b/tests/suite/test_python26.py @@ -645,7 +645,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as ValueError: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") except IOError: pass self.assertEqual(ValueError, orig_ValueError) @@ -654,7 +654,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as ValueError: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") finally: pass except IOError: @@ -693,7 +693,7 @@ def test_pep3110(self): try: raise IOError("xyz") except (TypeError, ValueError) as e: - Fail("IOError is not the same as TypeError or ValueError") + self.fail("IOError is not the same as TypeError or ValueError") except IOError: pass self.assertEqual(e, None) @@ -702,7 +702,7 @@ def test_pep3110(self): try: raise IOError("xyz") except (TypeError, ValueError) as e: - Fail("IOError is not the same as TypeError or ValueError") + self.fail("IOError is not the same as TypeError or ValueError") finally: pass except IOError: @@ -745,7 +745,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as e: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") except IOError as e: self.assertEqual(e.args[0], "abc") e = None @@ -753,7 +753,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as e: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") except IOError as e: self.assertEqual(e.args[0], "abc") e = None @@ -761,7 +761,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as e: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") except Exception as e: self.assertEqual(e.args[0], "abc") e = None @@ -769,7 +769,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as e: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") except: pass @@ -778,7 +778,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as e: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") except IOError as e: self.assertEqual(e.args[0], "abc") e = None @@ -787,7 +787,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as ValueError: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") except IOError as e: self.assertEqual(e.args[0], "abc") e = None @@ -796,7 +796,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as e: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") except IOError as e: self.assertEqual(e.args[0], "abc") e = None @@ -805,7 +805,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as ValueError: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") finally: pass except Exception as e: @@ -816,7 +816,7 @@ def test_pep3110(self): try: raise IOError("abc") except TypeError as e: - Fail("IOError is not the same as TypeError") + self.fail("IOError is not the same as TypeError") finally: pass except IOError: @@ -964,14 +964,14 @@ def test_generatorexit(self): try: raise GeneratorExit() except Exception: - Fail("Should not have caught this GeneratorExit") + self.fail("Should not have caught this GeneratorExit") except GeneratorExit: pass try: raise GeneratorExit() except Exception: - Fail("Should not have caught this GeneratorExit") + self.fail("Should not have caught this GeneratorExit") except GeneratorExit: pass finally: diff --git a/tests/suite/test_regressions.py b/tests/suite/test_regressions.py index 29342ff5f..7ed496752 100644 --- a/tests/suite/test_regressions.py +++ b/tests/suite/test_regressions.py @@ -105,26 +105,26 @@ def test_cp16831(self): temp.BProperty = True for i in range(2): if not temp.BProperty: - Fail("Nullable Boolean was set to True") + self.fail("Nullable Boolean was set to True") for i in range(2): if not temp.BProperty==True: - Fail("Nullable Boolean was set to True") + self.fail("Nullable Boolean was set to True") temp.BProperty = False for i in range(2): if temp.BProperty: - Fail("Nullable Boolean was set to False") + self.fail("Nullable Boolean was set to False") for i in range(2): if not temp.BProperty==False: - Fail("Nullable Boolean was set to False") + self.fail("Nullable Boolean was set to False") temp.BProperty = None for i in range(2): if temp.BProperty: - Fail("Nullable Boolean was set to None") + self.fail("Nullable Boolean was set to None") for i in range(2): if not temp.BProperty==None: - Fail("Nullable Boolean was set to None") + self.fail("Nullable Boolean was set to None") def test_cp_27434(self): tests = { diff --git a/tests/suite/test_regressions_compiled.py b/tests/suite/test_regressions_compiled.py index 1fb109680..4dfe5cc26 100644 --- a/tests/suite/test_regressions_compiled.py +++ b/tests/suite/test_regressions_compiled.py @@ -28,7 +28,7 @@ def test_gh1357(self): try: clr.CompileModules(dll, filename) except: - Fail('Failed to compile the specified file') + self.fail('Failed to compile the specified file') finally: os.unlink(filename) os.unlink(dll) @@ -46,7 +46,7 @@ def test_ipy3_gh1601(self): try: clr.CompileModules(dll, filename) except: - Fail('Failed to compile the specified file') + self.fail('Failed to compile the specified file') finally: os.unlink(filename) os.unlink(dll) diff --git a/tests/suite/test_slots.py b/tests/suite/test_slots.py index 52cb46b9a..25d5e50a9 100644 --- a/tests/suite/test_slots.py +++ b/tests/suite/test_slots.py @@ -16,7 +16,7 @@ class C(object): def __init__(self): try: self.b = 2 except AttributeError: pass - else: Fail("should have thrown") + else: self.fail("should have thrown") self.assertEqual(str(C.a), "") diff --git a/tests/suite/test_syntax.py b/tests/suite/test_syntax.py index 2e8aed8d1..51d210ee6 100644 --- a/tests/suite/test_syntax.py +++ b/tests/suite/test_syntax.py @@ -493,7 +493,7 @@ def ret_from_finally_x2(): except AssertionError as e: self.assertEqual(e.args[0], "This one") else: - Fail("Expected AssertionError, got none") + self.fail("Expected AssertionError, got none") try: pass