3 ms·
Makefiles are great for what they were made for. Compiling a binary? You should consider using Make. I get frustrated when I start seeing tests and run command
by move-on-by 3y ago
Makefiles are great for what they were made for. Compiling a binary? You should consider using Make.
I get frustrated when I start seeing tests and run commands hidden behind a make task. An example I saw recently was using a makefile to run docker compose. Simple enough, but it used a non-standard docker compose file, so it required the -f flag for every invocation. Which is fine since that’s handled for you by the makefile. Then it had docker compose run commands to invoke pytests. One key feature of running tests is passing arguments to limit test runs to specific packages/files/functions- but of course passing arguments down to a command isn’t supported by Make. All very convoluted and not the best tool for the job IMO. A simple bash script with “$@“ to pass my args to pytest is a lot more straightforward and allows pytest features to be used without needing to do anything extra.
- taeric 3y agoThis is silly. Make was made for hierarchical tasks that can be done incrementally. This was largely about compiling things, sure. But, I'd wager all old make files have test targets. My favorite example in recentish times is http://ftp.cs.stanford.edu/pub/sgb/Makefile http://ftp.cs.stanford.edu/pub/sgb/Makefile. And yeah, has a test target. That docker compose and friend weren't good for building on top of is their "fault," as it were. Stability of software is not something that modern build tools really take to heart, sadly. Note that this is not "do not crash" stability. I cede that progress is progress, such that there may be better tools today. I'd hesitate to base anything on python's ecosystem, sadly. They jumped a hell of a shark in the past few years that will be tough to get trust back on.
- paulddraper 3y ago> but of course passing arguments down to a command isn’t supported by Make Sure it is. .PHONY: test test: pytest $TEST_FILTER make TEST_FILTER=example test