Skip to content

Fix(?): Use context manager for writing Makefile, improve TestSuite on Windows

Istvan Kiss requested to merge fix/makefile-try-contextmanager-write into develop

Rationale

To improve testsuite on Windows, and in general, make the file write cleaner, a context manager is used instead of separate opening, writing, closing of the Makefile.

What has been changed

The Makefile content is generated into a string, then written to the Makefile in the context manager. This has been done with minimal changes to the code base, might be improved with refactoring later.

Testcase adjustments

Some testcases (see log snippet below) had to be updated, since the related Makefiles are not generated anymore.

Results

With these improvements, the number of failing TCs decreased by 4 on Windows. Full Testsuite is passing on Linux.

TODO(?)

Possible improvement could be to add assertions to make sure no Makefiles are generated if there are errors in Manifest.py.

Testsuite log snippet before updating the testsuite

================================================= short test summary info =============================================
FAILED test_all.py::test_quartus035 - FileNotFoundError: [Errno 2] No such file or directory: '035quartus_err/Makefile'
FAILED test_all.py::test_quartus036 - FileNotFoundError: [Errno 2] No such file or directory: '036quartus_err/Makefile'
FAILED test_all.py::test_quartus037 - FileNotFoundError: [Errno 2] No such file or directory: '037quartus_err/Makefile'
FAILED test_all.py::test_quartus038 - FileNotFoundError: [Errno 2] No such file or directory: '038quartus_err/Makefile'

Merge request reports