Skip to content

Commit

Permalink
Automatically add the unit test command to Quantum’s command environm…
Browse files Browse the repository at this point in the history
…ent when the plugin is loaded.
  • Loading branch information
uclatommy committed May 11, 2017
1 parent 7770f8b commit 464cf63
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 deletions.
Empty file.
19 changes: 0 additions & 19 deletions PyCell/Plugins/PyCell/tests/test_all.py

This file was deleted.

36 changes: 36 additions & 0 deletions PyCell/Plugins/PyCell/tests/test_pycell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
""" This module defines unit tests that can be run from within Quantum's
interactive console.
To run these tests from interactive console:
>>> exec(open('plugins/PyCell/tests/test_all.py').read())
"""
# import test_symengine_cell
import test_sympy_cell
import test_utility_cell
import test_projection_cell
import test_logic_cell
import test_dataframe_cell
from command import SingletonCommand
import Quantum

class TestPyCell(SingletonCommand):
"""
Run PyCell unit tests.
"""
def execute(self):
test_dataframe_cell.run_test()

@property
def name(self):
return "test_pycell"

Q = Quantum.QuKernel()
test_pycell = TestPyCell()
Q.COMMANDS[test_pycell.name] = test_pycell.execute
SingletonCommand().app.main.names.update(Q.COMMANDS)
# test_symengine_cell.run_test()
#test_sympy_cell.run_test()
#test_utility_cell.run_test()
#test_projection_cell.run_test()
#test_logic_cell.run_test()
#test_dataframe_cell.run_test()
1 change: 1 addition & 0 deletions pycell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ extern "C" PYCELL_API void registerPlugin(Quantum::Kernel &kernel)

kernel.getCellRegistry().addCell(add_this, name);
}
PyRun_SimpleString("import test_pycell");
}
catch (bp::error_already_set)
{
Expand Down

0 comments on commit 464cf63

Please sign in to comment.