''' Tests for fortran sequential files ''' import tempfile import shutil import os from os import path from glob import iglob import threading import re from numpy.testing import assert_equal, assert_allclose import numpy as np import pytest from scipy.io import (FortranFile, _test_fortran, FortranEOFError, FortranFormattingError) DATA_PATH = path.join(path.dirname(__file__), 'data') @pytest.fixture def io_lock(): return threading.Lock() def test_fortranfiles_read(io_lock): for filename in iglob(path.join(DATA_PATH, "fortran-*-*x*x*.dat")): m = re.search(r'fortran-([^-]+)-(\d+)x(\d+)x(\d+).dat', filename, re.I) if not m: raise RuntimeError(f"Couldn't match {filename} filename to regex") dims = (int(m.group(2)), int(m.group(3)), int(m.group(4))) dtype = m.group(1).replace('s', '<') with io_lock: f = FortranFile(filename, 'r', '