Skip to content
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

CI: create test_file.nc before step to run test suite #291

Merged

Conversation

sadielbartholomew
Copy link
Member

A netCDF file for testing on, test_file.nc is written out and used by the run_test.py script that runs the full test suite, and locally this works fine, but for the Actions jobs it is not being recognised, at least within the test_Field module:

Running tests from /home/runner/work/cf-python/cf-python/main/cf/test

    class FieldTest(unittest.TestCase):
  File "/home/runner/work/cf-python/cf-python/main/cf/test/test_Field.py", line 80, in FieldTest
    f = cf.read(filename)[0]
  File "/home/runner/work/cf-python/cf-python/cfdm/cfdm/decorators.py", line 171, in verbose_override_wrapper
    return method_with_verbose_kwarg(*args, **kwargs)
  File "/home/runner/work/cf-python/cf-python/main/cf/read_write/read.py", line 699, in read
    open(file_glob, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/cf-python/cf-python/main/cf/test/test_file.nc'

This PR aims to fix this so that the required file is generated by the Actions jobs and available for use by that script (as wrapped by the coverage-checking script), as opposed to committing it permanently to the repo which is a simple solution but is not preferred for various reasons.

Some trial-and-error is anticipated to get this working.

@sadielbartholomew
Copy link
Member Author

Opening and closing to trigger the CI jobs...

@codecov-commenter
Copy link

Codecov Report

Merging #291 (fa8d713) into master (a08ac1f) will increase coverage by 0.11%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #291      +/-   ##
==========================================
+ Coverage   73.80%   73.90%   +0.11%     
==========================================
  Files          85       88       +3     
  Lines       19179    19632     +453     
==========================================
+ Hits        14153    14507     +354     
- Misses       5026     5125      +99     
Flag Coverage Δ
unittests 73.90% <ø> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
main/cf/domain.py 67.00% <0.00%> (-8.00%) ⬇️
main/cf/constructs.py 91.43% <0.00%> (-4.02%) ⬇️
main/cf/data/partitionmatrix.py 93.34% <0.00%> (-1.53%) ⬇️
main/cf/regrid/regridoperator.py 94.34% <0.00%> (-1.21%) ⬇️
main/cf/dimensioncoordinate.py 68.68% <0.00%> (-0.96%) ⬇️
main/cf/read_write/read.py 92.18% <0.00%> (-0.84%) ⬇️
main/cf/formula_terms.py 88.38% <0.00%> (-0.48%) ⬇️
main/cf/data/partition.py 85.54% <0.00%> (-0.35%) ⬇️
main/cf/data/data.py 78.87% <0.00%> (-0.11%) ⬇️
main/cf/regrid/utils.py 60.39% <0.00%> (-0.04%) ⬇️
... and 28 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e0321fa...fa8d713. Read the comment docs.

@sadielbartholomew
Copy link
Member Author

sadielbartholomew commented Dec 23, 2021

The fix applied, which seems to work now for the run-test-suite workflow, is to run a separate step to create the test file before the step that runs run_test.py via the run_tests_and_coverage bash script wrapper. Locally that script generates the test file on-the-fly but I think it doesn't work with the Actions workflow because files need to be persisted explicitly to be recognised and I can't find a way in the documentation to register it as it is created, so a separated step before is harmless.

Now applying the working fix to the test-source-dist which is hitting the same issue.

@sadielbartholomew
Copy link
Member Author

Re-triggering...

@sadielbartholomew
Copy link
Member Author

Again...

@sadielbartholomew
Copy link
Member Author

Now the test-source-dist workflow single job creates and uses the test_file.nc appropriately, but fails for a reason unrelated to this PR, namely:

======================================================================
FAIL: test_relative_vorticity_latlong (test_Maths.MathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/tmp/test_cf-python/cf/test/test_Maths.py", line 105, in test_relative_vorticity_latlong
    self.assertTrue(numpy.allclose(rv.array, rv_array))
AssertionError: False is not true

----------------------------------------------------------------------
Ran 337 tests in 793.486s

FAILED (failures=1)

which I will raise elsewhere. So that workflow can be considered done for the purposes of this PR.

@sadielbartholomew
Copy link
Member Author

Now the test-source-dist workflow single job creates and uses the test_file.nc appropriately, but fails for a reason unrelated to this PR

Ditto for the run-test-suite... so all good to go!

@davidhassell
Copy link
Collaborator

Hi Sadie. Ah - that makes sense, and I should have tested for it in #290. The fix there will change the results of relative vorticity calculations. I'll have a look at test_relative_vorticity_latlong

@davidhassell
Copy link
Collaborator

b77e5a2 should fix this for now. The whole vorticity thing needs overhauling, so it's not worth doing a more thorough job at this time.

@davidhassell davidhassell added this to the 3.12.0 milestone Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants