Show More
@@ -1,58 +0,0 b'' | |||
|
1 | """test the IPython Kernel""" | |
|
2 | ||
|
3 | #------------------------------------------------------------------------------- | |
|
4 | # Copyright (C) 2013 The IPython Development Team | |
|
5 | # | |
|
6 | # Distributed under the terms of the BSD License. The full license is in | |
|
7 | # the file COPYING, distributed as part of this software. | |
|
8 | #------------------------------------------------------------------------------- | |
|
9 | ||
|
10 | #------------------------------------------------------------------------------- | |
|
11 | # Imports | |
|
12 | #------------------------------------------------------------------------------- | |
|
13 | ||
|
14 | import os | |
|
15 | import shutil | |
|
16 | import sys | |
|
17 | import tempfile | |
|
18 | ||
|
19 | import nose.tools as nt | |
|
20 | ||
|
21 | from IPython.testing import decorators as dec | |
|
22 | from IPython.utils import path, py3compat | |
|
23 | ||
|
24 | from .utils import new_kernel, kernel, TIMEOUT, assemble_output, execute, flush_channels | |
|
25 | ||
|
26 | #------------------------------------------------------------------------------- | |
|
27 | # Tests | |
|
28 | #------------------------------------------------------------------------------- | |
|
29 | IPYTHONDIR = None | |
|
30 | save_env = None | |
|
31 | save_get_ipython_dir = None | |
|
32 | ||
|
33 | def setup(): | |
|
34 | """setup temporary IPYTHONDIR for tests""" | |
|
35 | global IPYTHONDIR | |
|
36 | global save_env | |
|
37 | global save_get_ipython_dir | |
|
38 | ||
|
39 | IPYTHONDIR = tempfile.mkdtemp() | |
|
40 | ||
|
41 | save_env = os.environ.copy() | |
|
42 | os.environ["IPYTHONDIR"] = IPYTHONDIR | |
|
43 | ||
|
44 | save_get_ipython_dir = path.get_ipython_dir | |
|
45 | path.get_ipython_dir = lambda : IPYTHONDIR | |
|
46 | print 'setup' | |
|
47 | ||
|
48 | ||
|
49 | def teardown(): | |
|
50 | print 'tearing down' | |
|
51 | path.get_ipython_dir = save_get_ipython_dir | |
|
52 | os.environ = save_env | |
|
53 | ||
|
54 | try: | |
|
55 | shutil.rmtree(IPYTHONDIR) | |
|
56 | except (OSError, IOError): | |
|
57 | # no such file | |
|
58 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now