Skip to main content

test framework for OpenFOAM

  • Free software: GPLv3 License

Installation

pip install oftest

You can also install the in-development version with:

pip install https://github.com/HenningScheufler/oftest/archive/master.zip

Documentation

https://oftest.readthedocs.io/

Development

To run all the tests run and build the doc:

tox

QuickStart

add conftest.py and pytest.ini to your project

cat pytest.ini:

[pytest]
#minversion = 6.0
addopts = -ra -v --import-mode=importlib --tb=no --cache-clear
testpaths =
    tests

cat conftest.py:

import pytest

def pytest_addoption(parser):
    parser.addoption(
        "--writeNSteps", action="store", default=0, help="only perform specified number of timestep"
    )
    parser.addoption(
        "--no-clean-up", action='store_false',default=True ,help="do not clean case after run"
    )

we assume that all OpenFOAM test are located in the tests folder and that each test can be started with a Allrun or Allclean script. By adding a test_*.py to each OpenFOAM test, py.test automatically discovers all tests in the folder and they can be run with:

py.test

with the command line option the test only run one time step

py.test --writeNSteps 1

Extensions

Running py.test with multple threads:

pip install pytest-xdist

the output can be pretified with the extension:

pip install pytest-sugar

Changelog

0.2.1 (2021-1-25)

added: - path_logs get all log.* in folder

0.2.0 (2021-1-20)

added: - log files are copied in logs folder

0.1.2 (2021-12-22)

added: - success to run_case, run_reset_case, clean_case - copy_log_files

::

accessible with run_reset_case.success

add copy_log_files() copy files to os.path.join(“logs”,current_test()) use case if (not run_reset_case.success) oftest.copy_log_files()

0.1.1 (2021-12-22)

added exit code to run_case, run_reset_case, clean_case accessible with: c_mod.meta_data[‘return_value’]

0.1.0 (2021-05-7)

added expected_results: loads a results in csv format and return the results in a pandas DataFrame:

test = oftest.expected_results([1,2],(‘isoAlpha’,32)) test[‘err_shape’]

0.0.5 (2021-05-7)

update documentation and added docstrings

0.0.4 (2021-04-24)

  • added fixture for running cleaning and modify

break compatiblity due to run_case does not clean the case anymore please substitute with run_reset_case

TL;DR

run_case -> run_reset_case

0.0.3 (2021-04-23)

  • changed License to GPL -> pyfoam is GPLv2

0.0.0 (2021-04-17)

  • First release on PyPI.

Metadata

Release files for oftest 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oftest 0.2.1
File Size Uploaded
oftest-0.2.1.tar.gz 61.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oftest 0.2.1
File Interpreter ABI Platform
oftest-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 81.0 kB

Release files / oftest-0.2.1.tar.gz

Download URL oftest-0.2.1.tar.gz
Size 61.2 kB
Tags Source
SHA-256 checksum
How to use checksums
284b16dbeaf68bdadfae68306ff069b8e5a7be9efc03c22ec33ed82d45067386
BLAKE2b-256 checksum
How to use checksums
e24031ea29a50e431b354d3ed9ee85547872e0704730f58fa884629100b3c7ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

Release files / oftest-0.2.1-py2.py3-none-any.whl

Download URL oftest-0.2.1-py2.py3-none-any.whl
Size 19.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
250f1b4384f4ba0ac362df8c9c39918e2d3faca48f9042f96b1dca28f7f9f54f
BLAKE2b-256 checksum
How to use checksums
09361dca2e728fada9dcee8297712d9a4e5fb03e0c088d725d6d267fb6f29f30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page