pyfmu.tests
¶
Submodules¶
pyfmu.tests.example_finder
pyfmu.tests.export_all
pyfmu.tests.test_cosim
pyfmu.tests.test_examples
pyfmu.tests.test_export
pyfmu.tests.test_fmi2slave
pyfmu.tests.test_fmi2validation
pyfmu.tests.test_fmi2variables
pyfmu.tests.test_generate
pyfmu.tests.test_logging
pyfmu.tests.test_model_description
pyfmu.tests.test_validation
Package Contents¶
-
class
pyfmu.tests.
PyfmuProject
(root: Path, main_class: str = None, main_script: str = None, main_script_path: Path = None, project_configuration: dict = None, project_configuration_path: Path = None, resources_dir: Path = None)¶ Object representing an pyfmu project.
-
static
from_existing
(p: Path)¶ Instantiates an object representation based on an existing project
- Arguments:
p {Path} – path to the root of the project
-
static
-
pyfmu.tests.
compress
(in_dir, out_dir=None, fmt='zip', extension: str = None)¶ Compresses
- Arguments:
in_dir {[type]} – the directory to compress
- Keyword Arguments:
out_dir {[type]} – output archive (default: {None})
-
pyfmu.tests.
rm
(path)¶ Delete a file or a directory
- Arguments:
p {Path} – path to a directory or a file
-
pyfmu.tests.
_ssp_examples
= ['SumOfSines']¶
-
pyfmu.tests.
_correct_example
¶
-
pyfmu.tests.
_incorrect_examples
¶
-
pyfmu.tests.
get_example_directory
() → Path¶ Returns the path to the example projects
-
pyfmu.tests.
get_incorrect_examples
()¶ Returns the set of examples that are expected to fail
- Returns:
[Set] – The set of all examples which are designed to cause faults.
-
pyfmu.tests.
get_correct_examples
()¶ Returns the set of examples that are expected to work correctly.
- Returns:
[Set] – The set of all examples which should function correctly.
-
pyfmu.tests.
get_all_examples
()¶ Returns the set of all available examples including the ones that are expected to fail.
- Returns:
[Set] – The set of all available examples
-
pyfmu.tests.
get_system_example
(name: str) → Path¶ Returns the path to the specified SSP example.
- Arguments:
name {str} – name of the example zipped {bool} – returns path to zipped archive
- Returns:
Path – path to the example
-
pyfmu.tests.
get_example_project
(name: str) → Path¶ Gets the path to a specific example project.
-
pyfmu.tests.
get_exported_example_project
(name: str)¶ Gets the path to a specific example project, to get an fmu use get_example_fmu(…)
-
class
pyfmu.tests.
ExampleProject
(project_name: str)¶ Wrapper that encapsulates the creation of example projects used for automatic testing.
Wrapper that encapsulates the exporting of example archives used for automatic testing.
This allows them to be accessed using a with statements. Attributes such as the path to the object can be accessed through the archive object which is returned. ``` with ExampleProject(‘Adder’) as p:
print(p.modelDescription) …
The example project generated as a copy of an example project inside a temporary folder, which is freed after the with statement terminates. Modifications of properties such as its model description can be made through its properties: ``` with ExampleProject(‘Adder’) as p:
p.modelDescription = “invalid model description” …
-
__enter__
(self)¶
-
__exit__
(self, exception_type, exception_value, traceback)¶
-
-
class
pyfmu.tests.
ExampleArchive
(project_name: str)¶ Wrapper that encapsulates the exporting of example archives used for automatic testing.
This allows them to be accessed using a with statements. Attributes such as the path to the object can be accessed through the archive object which is returned. ``` with ExampleArchive(‘Adder’) as p:
print(p.modelDescription) …
The example project is exported as an FMU to a temporary folder, which is automatically freed after the with statement terminates.
-
__enter__
(self)¶
-
__exit__
(self, exception_type, exception_value, traceback)¶
-
-
class
pyfmu.tests.
ExampleSystem
(name, zipped=True)¶ Context manager for exporting example SSP projects for testing.
-
__enter__
(self)¶
-
__exit__
(self, exception_type, exception_value, traceback)¶
-
-
pyfmu.tests.
export_project
(project: PyfmuProject, outputPath: Path, overwrite=False, store_compressed: bool = True) → PyfmuArchive¶ Exports a pyfmu project as an FMU to the specified output path.
- Arguments:
project {PyfmuProject} – A PyfmuProject or the path to a project. outputPath {Path} – The path to which the FMU is exported.
- Keyword Arguments:
store_compressed {bool} – compress the exported FMU (default: {True})
- Raises:
RuntimeError: [description]
- Returns:
PyfmuArchive – An object representing the exported FMU.
-
class
pyfmu.tests.
PyfmuProject
(root: Path, main_class: str = None, main_script: str = None, main_script_path: Path = None, project_configuration: dict = None, project_configuration_path: Path = None, resources_dir: Path = None)¶ Object representing an pyfmu project.
-
static
from_existing
(p: Path)¶ Instantiates an object representation based on an existing project
- Arguments:
p {Path} – path to the root of the project
-
static
-
pyfmu.tests.
export_all
()¶