NCAS-CMS / NCAS-CMS/cf-python

Validate/run doctests when running the tests

Open
#4 1 comment 0 reactions 1 assignee View on GitHub

@sadielbartholomew is already working on this.

Since Mar 19, 2021.

Dominant language
Python
Stars
150
Forks
23
Avg merge
1d 11h
Merged PRs (30d)
2

Description

I could run the tests with python run_tests.py, though a few failed. Looking at the doctests, some appear to be invalid or incomplete.

Would be nice to fix these, so they can also be used as tests for the code and API.

Here's an example output of running the current doctests:

$ python -m doctest cf/units.py 
**********************************************************************
File "cf/units.py", line 11, in units.Units
Failed example:
    help(cf.Units())
Exception raised:
    Traceback (most recent call last):
      File "/home/kinow/Development/python/anaconda3/lib/python3.7/doctest.py", line 1329, in __run
        compileflags, 1), test.globs)
      File "<doctest units.Units[0]>", line 1, in <module>
        help(cf.Units())
    NameError: name 'cf' is not defined
**********************************************************************
1 items had failures:
   1 of   1 in units.Units
***Test Failed*** 1 failures.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.