New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests! #12

Merged
merged 35 commits into from Oct 26, 2016

Conversation

Projects
None yet
2 participants
@chaosphere2112
Contributor

chaosphere2112 commented Oct 5, 2016

Adds testing to CDMS. To run tests, execute python run_tests.py from the root directory. These will need a lot of cleaning up; the first 4-6 or so I exhaustively converted to "proper" unit tests, the last 20 or so I did not. On my machine, there are 5 failures and 2 errors.

Errors:

======================================================================
ERROR: testDRS (test_all_formats.TestFormats)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fries2/Projects/uvcdat/cdms/Test/test_all_formats.py", line 16, in testDRS
    f = self.getFile(os.path.join(cdat_info.get_sampledata_path(), 'ta_300_850_PCM_O_mm_xy_wa_r0000_0000.dic'))
  File "/Users/fries2/Projects/uvcdat/cdms/Test/basetest.py", line 11, in getFile
    f = cdms2.open(path, mode)
  File "/Users/fries2/anaconda/envs/uvcdat_latest/lib/python2.7/site-packages/cdms2/dataset.py", line 300, in openDataset
    return CdmsFile(path,mode,mpiBarrier=CdMpi)
  File "/Users/fries2/anaconda/envs/uvcdat_latest/lib/python2.7/site-packages/cdms2/dataset.py", line 989, in __init__
    raise CDMSError('Cannot open file %s (%s)'%(path,err))
CDMSError: Cannot open file /Users/fries2/anaconda/envs/uvcdat_latest/share/uvcdat/sample_data/ta_300_850_PCM_O_mm_xy_wa_r0000_0000.dic (No error)

======================================================================
ERROR: testHDF (test_all_formats.TestFormats)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fries2/Projects/uvcdat/cdms/Test/test_all_formats.py", line 13, in testHDF
    f = self.getDataFile("tdata.hdf")
  File "/Users/fries2/Projects/uvcdat/cdms/Test/basetest.py", line 17, in getDataFile
    return self.getFile(os.path.join(pth, "data", name))
  File "/Users/fries2/Projects/uvcdat/cdms/Test/basetest.py", line 11, in getFile
    f = cdms2.open(path, mode)
  File "/Users/fries2/anaconda/envs/uvcdat_latest/lib/python2.7/site-packages/cdms2/dataset.py", line 309, in openDataset
    file1 = CdmsFile(path,"r")
  File "/Users/fries2/anaconda/envs/uvcdat_latest/lib/python2.7/site-packages/cdms2/dataset.py", line 989, in __init__
    raise CDMSError('Cannot open file %s (%s)'%(path,err))
CDMSError: Cannot open file /Users/fries2/Projects/uvcdat/cdms/Test/data/tdata.hdf (No error)

We're missing a DRS test file, which is why testDRS errors (the path used is just what was in the test_all_formats file when I got there). Not sure about the testHDF test; the file is there, but for whatever reason it isn't working to open it.

Failures:

======================================================================
FAIL: testForecast (test_forecast_io.TestForecastIO)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fries2/Projects/uvcdat/cdms/Test/test_forecast_io.py", line 68, in testForecast
    self.assertTrue(tinaxis.isTime())
AssertionError: 0 is not true

======================================================================
FAIL: testTypes (test_numpy_nc4.TestNumpyWithNetCDF4)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fries2/Projects/uvcdat/cdms/Test/test_numpy_nc4.py", line 19, in testTypes
    self.assertEqual(s.dtype, t)
AssertionError: dtype('uint32') != <type 'numpy.uint64'>

======================================================================
FAIL: testRegrid2 (test_regrid2.TestRegridding)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fries2/Projects/uvcdat/cdms/Test/test_regrid2.py", line 97, in testRegrid2
    self.assertLess(abs(result[0,0,0]-3.26185), 1.e-4)
AssertionError: 2.26185 not less than 0.0001

======================================================================
FAIL: testTV (test_tvariable.TestTransientVariables)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fries2/Projects/uvcdat/cdms/Test/test_tvariable.py", line 50, in testTV
    self.assertEqual(tmv, -99.9)
AssertionError: 1e+20 != -99.9

======================================================================
FAIL: testSubSlice (test_variable_subselection.TestVariableSubselection)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/fries2/Projects/uvcdat/cdms/Test/test_variable_subselection.py", line 151, in testSubSlice
    s3 = self.var.subSlice(required='lumbarsupport')
AssertionError: CDMSError not raised

----------------------------------------------------------------------

These all look like things @dnadeau4 and @doutriaux1 should figure out, not me.

Sam Fries added some commits Oct 3, 2016

@chaosphere2112

This comment has been minimized.

Contributor

chaosphere2112 commented Oct 5, 2016

Note: I'm going to be refactoring test_mv2.py and probably test_regrid2.py in order to use them to test the provenance capture as well.

@chaosphere2112

This comment has been minimized.

Contributor

chaosphere2112 commented Oct 5, 2016

Also, you can run any test file individually using python.

@chaosphere2112

This comment has been minimized.

Contributor

chaosphere2112 commented Oct 6, 2016

@dnadeau4 @doutriaux1 I'm totally ready for this to be merged now.

@doutriaux1 doutriaux1 merged commit 9280d85 into master Oct 26, 2016

@doutriaux1 doutriaux1 deleted the test_migration branch Oct 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment