Skip to content

Unit Testing

George Dietz edited this page May 9, 2016 · 8 revisions

Python Unit Testing

To run all the unit tests:

  • Navigate to the OpenMEE base directory: git/OpenMEE

  • run python -m unittest discover -v . "*_test.py"

  • One may encounter issues with unittest + virtualenv. I have had success using unittest2, and specifying the particular module to be tested: python -m unittest2 python_to_R_test.py (these will run only those unit tests in python_to_R_test.py, which constitute those testing the Python-to-R bridge and hence cover the analyses implemented in OpenMEE.)

  • To run a particular testcase: python -m unittest python_to_R_test.TestCaseToTest

R Unit Testing

We're using the testthat package for our R unit tests. You may need to install it.

To run the R unit tests

  • Start R
  • Enter the following R commands:
    • library(devtools)
    • setwd (directory where openmeer is, e.g., "/Users/idahabreh/git/OpenMEE/R/openmeer")
    • devtools::test()