pySIMsalabim.tests package
Submodules
pySIMsalabim.tests.conftest module
pytest hooks for the pySIMsalabim tests.
Before the session, the test input files (sim_inputs/default) are brought to the SIMsalabim version and copied into SIMsalabim/SimSS and SIMsalabim/ZimT; after the session they are removed. See sim_inputs_setup.py for details.
pySIMsalabim.tests.sim_inputs_setup module
Prepare the SIMsalabim input files used by the pySIMsalabim tests.
The tests use their own input files, stored in sim_inputs/default/{SimSS,ZimT} and named
*_test.txt so that they never overwrite the user’s own files in the SIMsalabim folder.
prepare_test_inputs():compares the version of every
simulation_setup*.txtin sim_inputs (and of the layer files it references) with the SIMsalabim version (version = 'X.YY'in simss.pas / zimt.pas);on a mismatch, compiles SIMsalabim’s Updater (Tools/Updater/Updater.pas) if needed, places a temporary copy next to the input files and runs it interactively (the user answers its questions), converting them in place in sim_inputs (the converted files show up in
git statusand can be committed as the new baseline);copies the input files into SIMsalabim/SimSS and SIMsalabim/ZimT, where the tests run.
cleanup_test_inputs() deletes the copied files again, plus the Block.txt created by the
contactless-device tests (trPL) if it did not exist before.
Both are called by conftest.py (pytest session start/finish), by the __main__ block of
each test file when it is run directly, and by the example notebooks in Notebooks/.
The notebooks call prepare_test_inputs(convert=False): a Jupyter kernel cannot give the
interactive Updater a terminal, so on a version mismatch they stop and ask the user to convert the
files from a terminal with
python pySIMsalabim/tests/sim_inputs_setup.py
which only checks/converts the files in sim_inputs (nothing is copied).
- exception pySIMsalabim.tests.sim_inputs_setup.TestInputsError[source]
Bases:
RuntimeErrorRaised when the test input files cannot be prepared.
- pySIMsalabim.tests.sim_inputs_setup.cleanup_test_inputs()[source]
Delete the files copied by prepare_test_inputs() and the files generated by the tests.
- pySIMsalabim.tests.sim_inputs_setup.compile_updater()[source]
Compile SIMsalabim’s Updater if the binary is missing or older than Updater.pas. Returns the path to the binary.
- pySIMsalabim.tests.sim_inputs_setup.get_input_versions(input_dir, setup_name)[source]
Return {file name: version} for a simulation setup file and every layer file it references.
- pySIMsalabim.tests.sim_inputs_setup.get_simsalabim_version(program_dir)[source]
Return the version string (e.g. ‘5.37’) declared in SIMsalabim’s <prog>.pas source.
- pySIMsalabim.tests.sim_inputs_setup.prepare_test_inputs(log=<built-in function print>, terminal_access=<class 'contextlib.nullcontext'>, convert=True)[source]
Bring the test input files to the SIMsalabim version and copy them into SIMsalabim/SimSS and ZimT. log is called with each progress message (print by default; conftest.py passes pytest’s terminal writer). terminal_access is a context manager giving the interactive Updater access to the terminal. With convert=False (used by the notebooks) a version mismatch raises TestInputsError instead of running the Updater. All versions are checked before anything is copied.
- pySIMsalabim.tests.sim_inputs_setup.run_updater(updater_binary, input_dir, setup_name, terminal_access=<class 'contextlib.nullcontext'>)[source]
Run a temporary copy of the Updater in input_dir to convert setup_name and its layer files in place.
The Updater runs interactively in the user’s terminal: its output is shown and the user answers its questions (overwrite confirmation, warnings) themselves. terminal_access is a context manager that gives the subprocess the real terminal (conftest.py uses it to suspend pytest’s capturing). Returns the Updater’s exit code.
- pySIMsalabim.tests.sim_inputs_setup.sync_all_inputs(log=<built-in function print>, terminal_access=<class 'contextlib.nullcontext'>, convert=True)[source]
Check (and convert if needed and allowed) the SimSS and ZimT test input files. Returns the list of (program folder, input folder) that exist.
- pySIMsalabim.tests.sim_inputs_setup.sync_input_versions(input_dir, program_dir, log=<built-in function print>, terminal_access=<class 'contextlib.nullcontext'>, convert=True)[source]
Make sure every simulation_setup*.txt in input_dir (and the layer files it references) matches the SIMsalabim version, converting them if needed (or raising TestInputsError if convert is False).
pySIMsalabim.tests.test_CV module
Test the CV module of pySIMsalabim
pySIMsalabim.tests.test_DRT module
pySIMsalabim.tests.test_EQE module
Test EQE module with pySIMsalabim
pySIMsalabim.tests.test_IMPS module
Test the IMPS module of pySIMsalabim
pySIMsalabim.tests.test_JV module
Test the JV module of pySIMsalabim
pySIMsalabim.tests.test_JV_sweep module
Test the JV_sweep module of pySIMsalabim
- pySIMsalabim.tests.test_JV_sweep.test_JV_sweep_parallel()[source]
Test the JV_sweep_parallel function
pySIMsalabim.tests.test_hyst module
Test the hysteresis module of pySIMsalabim
- pySIMsalabim.tests.test_hyst.test_hysteresis_parallel()[source]
Test the hysteresis_parallel function
pySIMsalabim.tests.test_impedance module
Test the impedance module of pySIMsalabim
pySIMsalabim.tests.test_trPL module
Test the trPL module of pySIMsalabim