Changes between Version 23 and Version 24 of GSoC/2014/TestingFrameworkForGRASS


Ignore:
Timestamp:
May 30, 2014, 11:12:55 AM (10 years ago)
Author:
wenzeslaus
Comment:

suggestion to deal with dependecies of test code

Legend:

Unmodified
Added
Removed
Modified
  • GSoC/2014/TestingFrameworkForGRASS

    v23 v24  
    239239==== Dependencies of testing code ====
    240240
    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.
     241The 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
     246def 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
     252def 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}}}
    242257== Reports from testing ==
    243258