Skip to content

Re-work 'testing' directory structure #1515

@adrifoster

Description

@adrifoster

The current 'testing' direction is getting a bit out of hand. I'd like to create some sub-directories so that things are easier to find and use. My proposal is below:

testing/
├── run_functional.py   (formerly run_functional_tests.py) 
├── run_unit.py   (formerly run_unit_tests.py)
├── generate_test.py   (formerly generate_empty_test.py)
├── CMakeLists.txt 
├── environment.yml (formerly testing.yml)
├── README.md (formerly README.testing.md)
├── config/
│   ├── functional.cfg (formerly functional_test.cfg)
│   └── unit.cfg (formerly unit_tests.cfg)
├── tests/                        
│   ├── functional/
│   │   ├── ... testing dirs ...
│   ├── unit/
│   │   ├── ... testing dirs ...
│   ├── fortran_shr/
│   │   ├── CMakeLists.txt
│   │   └── *.F90
│   ├── data/            
│   │    └── *.csv, *.nc...
│
├── framework/             
│  ├── __init__.py 
│  ├── functional_class.py
│  ├── functional_class_with_drivers.py
│  ├── builder.py (formerly build_fortran_tests.py)
│  ├── generator.py (formerly test_generator_class.py)
│  ├── loader.py (formerly load_functional_tests.py)
│  ├── utils/
│  │   ├── __init__.py
│  │   ├── general.py (formerly utils.py)
│  │   ├── plotting.py (formerly utils_plotting.py)
│  │   ├── paths.py (formerly path_utils.py)
│  │   └── protocols.py
│
├── templates/
│   ├── cmake_ftest_template.txt
│   ├── cmake_utest_template.txt
│   ├── fortran_test_template.txt
│   ├── pfunit_template.txt
│   └── test_class_template.txt
├── docs/
│   ├── cime_setup.md

   

Explanation of each directory:


The top-level directory contains the executable scripts so they are easy to find and run, hide all supporting classes and helpers inside a framework directory


config/ - contains config files for the tests


tests/ - contains only code/files that represent actual tests

  • functional tests (each in own directory)
  • unit tests (each in own directory)
  • shared Fortran modules used by tests
  • data

framework/ - machinery to compile/run tests

framework/utils contains utilities for these


templates/ - templates for writing new tests


docs/ - documents


I think this will be nice because:

  1. we still can just do testing/run_functional.py like always
  2. no "pip install" required, all internal, we can just use a relative path import from the top-level scripts
  3. much cleaner and clearer - we only see 6 files at the top, not ~30

I would love to get folks' feedback on this structure! @ekluzek @rgknox @glemieux

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionNOTE: issues with discussion labels should be convertedtype: clean upSimple issues like typos, formatting, style guide alignment, etc.type: enhancementtype: refactorRestructures code without changing functionalitytype: testingRelated to improvements in code testing (e.g. unit, regression, etc)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions