I've had a dispute with some colleges on should I take a syntax check after every code modification as a distinct step or I'd better rely on unit tests to catch possible syntax breakage ... ( of course unit tests do that ).
This is not a question whether to use or not tests for your code ( of course yes, but see below )
My use case is pretty simple, I am newbie in Python and try to play with some web application (MVC) by modifying model file. The changes are quite simple, indeed a couple or so lines at once, however as I am pretty unfamiliar with Python syntax, some stupid errors ( like wrong indentation, so on ) easily creep into.
The real hurdle is that I deploy an application via Google Cloud Platform ( as app engine ), so it takes a while for application comes up with new version and I can hit an endpoint and finally look into its error logs to understand what's happening. So I'd like to get a shorter and simple way - at least for these types of errors - just running syntax check before deploy.
The central part of the dispute was that I hadn't been advised to take a syntax check explicitly, but better relying on higher level tests for this ( units tests for example ), on what I say that:
1) And don't have unit tests yet ( and even if I had them I'd treat them as a next step in my test chain ).
2) I only edit a certain file ( one and only one ), with a minimum modifications, and MOSTLY the types of errors I have ( as I told as I am newbie in Python ) is syntax errors, not logic or semantic ones, so as I assume I am safe to have just syntax checking and then give it a deploy. And even though I hit a semantic/logic problems with my code later ( even syntax check pass ) this is a undoubtedly question for high level tests ( unit / acceptance so on) - but for now I'm just playing with a code written in a language I am not feel quite at home.
3) I don't commit my changes outside and don't trouble anyone.
4) the last argument is controversial, because it's a bit of the scope, however I'd like to leave it here - in some cases even lightweight unit tests might be overkill if ALL you need is to get a syntax check in a single file. Consider this example. One just edits the code in place, deployed at server trying to fix immediate issues, so no unit or other tests exists and you want to be sure that your modification won't break the code syntactically.