Show More
@@ -530,6 +530,10 class TestSafeExecfileNonAsciiPath(unittest.TestCase): | |||
|
530 | 530 | ip.safe_execfile(self.fname, {}, raise_exceptions=True) |
|
531 | 531 | |
|
532 | 532 | class ExitCodeChecks(tt.TempFileMixin): |
|
533 | ||
|
534 | def setUp(self): | |
|
535 | self.system = ip.system_raw | |
|
536 | ||
|
533 | 537 | def test_exit_code_ok(self): |
|
534 | 538 | self.system('exit 0') |
|
535 | 539 | self.assertEqual(ip.user_ns['_exit_code'], 0) |
@@ -559,8 +563,11 class ExitCodeChecks(tt.TempFileMixin): | |||
|
559 | 563 | del os.environ['SHELL'] |
|
560 | 564 | |
|
561 | 565 | |
|
562 |
class TestSystemRaw(ExitCodeChecks |
|
|
563 | system = ip.system_raw | |
|
566 | class TestSystemRaw(ExitCodeChecks): | |
|
567 | ||
|
568 | def setUp(self): | |
|
569 | super().setUp() | |
|
570 | self.sytem = ip.system_raw | |
|
564 | 571 | |
|
565 | 572 | @onlyif_unicode_paths |
|
566 | 573 | def test_1(self): |
@@ -580,8 +587,11 class TestSystemRaw(ExitCodeChecks, unittest.TestCase): | |||
|
580 | 587 | self.assertEqual(ip.user_ns['_exit_code'], -signal.SIGINT) |
|
581 | 588 | |
|
582 | 589 | # TODO: Exit codes are currently ignored on Windows. |
|
583 |
class TestSystemPipedExitCode(ExitCodeChecks |
|
|
584 | system = ip.system_piped | |
|
590 | class TestSystemPipedExitCode(ExitCodeChecks): | |
|
591 | ||
|
592 | def setUp(self): | |
|
593 | super().setUp() | |
|
594 | self.sytem = ip.system_piped | |
|
585 | 595 | |
|
586 | 596 | @skip_win32 |
|
587 | 597 | def test_exit_code_ok(self): |
@@ -595,7 +605,7 class TestSystemPipedExitCode(ExitCodeChecks, unittest.TestCase): | |||
|
595 | 605 | def test_exit_code_signal(self): |
|
596 | 606 | ExitCodeChecks.test_exit_code_signal(self) |
|
597 | 607 | |
|
598 |
class TestModules(tt.TempFileMixin |
|
|
608 | class TestModules(tt.TempFileMixin): | |
|
599 | 609 | def test_extraneous_loads(self): |
|
600 | 610 | """Test we're not loading modules on startup that we shouldn't. |
|
601 | 611 | """ |
@@ -944,7 +954,7 def wrn(): | |||
|
944 | 954 | |
|
945 | 955 | class TestImportNoDeprecate(tt.TempFileMixin): |
|
946 | 956 | |
|
947 |
def set |
|
|
957 | def setUp(self): | |
|
948 | 958 | """Make a valid python temp file.""" |
|
949 | 959 | self.mktmp(""" |
|
950 | 960 | import warnings |
@@ -954,6 +964,7 def wrn(): | |||
|
954 | 964 | DeprecationWarning |
|
955 | 965 | ) |
|
956 | 966 | """) |
|
967 | super().setUp() | |
|
957 | 968 | |
|
958 | 969 | def test_no_dep(self): |
|
959 | 970 | """ |
@@ -165,7 +165,7 def doctest_reset_del(): | |||
|
165 | 165 | |
|
166 | 166 | class TestMagicRunPass(tt.TempFileMixin): |
|
167 | 167 | |
|
168 |
def set |
|
|
168 | def setUp(self): | |
|
169 | 169 | content = "a = [1,2,3]\nb = 1" |
|
170 | 170 | self.mktmp(content) |
|
171 | 171 |
@@ -24,6 +24,8 from io import StringIO | |||
|
24 | 24 | import nose.tools as nt |
|
25 | 25 | import IPython.testing.tools as tt |
|
26 | 26 | |
|
27 | from unittest import TestCase | |
|
28 | ||
|
27 | 29 | from IPython.testing.decorators import skipif |
|
28 | 30 | |
|
29 | 31 | from IPython.extensions.autoreload import AutoreloadMagics |
@@ -63,7 +65,7 class FakeShell: | |||
|
63 | 65 | self.auto_magics.post_execute_hook() |
|
64 | 66 | |
|
65 | 67 | |
|
66 |
class Fixture( |
|
|
68 | class Fixture(TestCase): | |
|
67 | 69 | """Fixture for creating test module files""" |
|
68 | 70 | |
|
69 | 71 | test_dir = None |
@@ -85,7 +85,7 class TestAssertPrints(unittest.TestCase): | |||
|
85 | 85 | self.assertRaises(AssertionError, func) |
|
86 | 86 | |
|
87 | 87 | |
|
88 |
class Test_ipexec_validate( |
|
|
88 | class Test_ipexec_validate(tt.TempFileMixin): | |
|
89 | 89 | def test_main_path(self): |
|
90 | 90 | """Test with only stdout results. |
|
91 | 91 | """ |
@@ -13,6 +13,7 import os | |||
|
13 | 13 | import re |
|
14 | 14 | import sys |
|
15 | 15 | import tempfile |
|
16 | import unittest | |
|
16 | 17 | |
|
17 | 18 | from contextlib import contextmanager |
|
18 | 19 | from io import StringIO |
@@ -262,7 +263,7 def ipexec_validate(fname, expected_out, expected_err='', | |||
|
262 | 263 | nt.assert_equal("\n".join(out.strip().splitlines()), "\n".join(expected_out.strip().splitlines())) |
|
263 | 264 | |
|
264 | 265 | |
|
265 |
class TempFileMixin( |
|
|
266 | class TempFileMixin(unittest.TestCase): | |
|
266 | 267 | """Utility class to create temporary Python/IPython files. |
|
267 | 268 | |
|
268 | 269 | Meant as a mixin class for test cases.""" |
@@ -90,7 +90,7 def test_arg_split_win32(): | |||
|
90 | 90 | nt.assert_equal(arg_split(argstr), argv) |
|
91 | 91 | |
|
92 | 92 | |
|
93 |
class SubProcessTestCase( |
|
|
93 | class SubProcessTestCase(tt.TempFileMixin): | |
|
94 | 94 | def setUp(self): |
|
95 | 95 | """Make a valid python temp file.""" |
|
96 | 96 | lines = [ "import sys", |
General Comments 0
You need to be logged in to leave comments.
Login now