forked from reingart/pyafipws
-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Description
Several unit tests are failing on macOS due to the usage of os.startfile, which is a Windows-specific function. The tests fail with an AttributeError: module 'os' has no attribute 'startfile'.
Affected Tests
The following tests are affected:
test_pyfepdf.py::test_mostrar_pdftest_pyi25.py::test_main_mostrartest_pyqr.py::test_main_mostrar
Suggested Fix
A possible fix is to create a platform-independent function that behaves like os.startfile on all platforms. On Windows, it can use os.startfile, and on macOS and Linux, it can use the open command via subprocess.call. This function can then be used to replace os.startfile during testing using mocker.patch.
Here's an example of how this function can look like:
def open_file(path):
if platform.system() == "Windows":
os.startfile(path)
else:
subprocess.call(["open", path])
Metadata
Metadata
Assignees
Labels
No labels
