Running Matlab and GNU Octave via Pytest

A software package may have Matlab and Python functions. Plain Matlab code can be included via Pytest for Matlab and GNU Octave. To test the Matlab functions from Pytest, create

This assumes the Matlab test script resides in the same directory as “”.

NOTE: Be sure that Matlab “runtests()” actually picks up the desired tests. We do not want the Matlab output to say

   0 Passed, 0 Failed, 0 Incomplete.
   0 seconds testing time.

Generally, Python __file__ is not robust for packages but one might relax that restriction for test files where a clear error will result.