241 | | The testing code could use some third party tools to compare results of GRASS to results of these tools. This of course might be very different set of dependencies than the GRASS itself code has. For example, we can compare result of some computation to result of a function available in [http://www.scipy.org/ SciPy]. These test will probably be not allowed. |
| 241 | The testing code could use some third party tools to compare results of GRASS to results of these tools. This of course might be very different set of dependencies than the GRASS itself code has. For example, we can compare result of some computation to result of a function available in [http://www.scipy.org/ SciPy]. These test will probably be not allowed. If the tests would be allowed the most simple thing is probably check the dependencies in `setUp` or `setUpClass` methods. In case of import, it would need to be done once again in the actual test method (or we can assign the necessary imported classes to attributes). |
| 242 | |
| 243 | {{{ |
| 244 | #!python |
| 245 | # loading the dependency in setUp method and using it later |
| 246 | def setUp(self): |
| 247 | # will raise import error which will cause error in test (as opposed to test failure) |
| 248 | from scipy import something |
| 249 | # save this for later user in test method(s) |
| 250 | self.something = something |
| 251 | |
| 252 | def test_some_test(self): |
| 253 | a = ... |
| 254 | b = self.something(params, ...) |
| 255 | self.assertEqual(a, b, "The a result differs from the result of the function from scipy") |
| 256 | }}} |