Skip to content

Commit

Permalink
Create the test suite for Pure Python imports ipython#4
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyfast committed Apr 25, 2018
1 parent 66e5e22 commit bc5d46d
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions tests/unittests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@
" from unittest import TestCase, expectedFailure, skipUnless\n",
" from IPython import get_ipython\n",
" from IPython.utils.capture import capture_output\n",
" from importnb import Notebook, reload, Partial"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
" skipIPython = skipUnless(get_ipython(), \"\"\"IPython is not available\"\"\")"
" from importnb import Notebook, reload, Partial, load_ipython_extension, unload_ipython_extension"
]
},
{
Expand All @@ -31,9 +22,9 @@
" def setUp(Test):\n",
" if get_ipython():\n",
" %reload_ext importnb\n",
" else: ...\n",
" else: \n",
" load_ipython_extension()\n",
" \n",
" @skipIPython\n",
" def test_import(Test):\n",
" try:\n",
" from . import loader\n",
Expand All @@ -44,15 +35,15 @@
" assert loader.test is 42\n",
" assert isinstance(loader, __import__('types').ModuleType)\n",
" \n",
" @skipIPython\n",
" @expectedFailure\n",
" def test_failure(Test):\n",
" from . import failure\n",
" \n",
" def tearDown(Test):\n",
" if get_ipython():\n",
" %unload_ext importnb\n",
" else: ...\n"
" else: \n",
" unload_ipython_extension()\n"
]
},
{
Expand Down Expand Up @@ -114,7 +105,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"scrolled": false
},
Expand All @@ -124,7 +115,19 @@
"output_type": "stream",
"text": [
"Test IPython \n",
"\n"
"\n",
"..xx..\n",
"----------------------------------------------------------------------\n",
"Ran 6 tests in 2.013s\n",
"\n",
"OK (expected failures=2)\n",
"\u001b]0;IPython: importnb/tests\u0007Test Python \n",
"\n",
"..xss.\n",
"----------------------------------------------------------------------\n",
"Ran 6 tests in 2.016s\n",
"\n",
"OK (skipped=2, expected failures=1)\n"
]
}
],
Expand Down

0 comments on commit bc5d46d

Please sign in to comment.