Has anyone seen an error in unit tests that says there is no indented block inside of the test code? I have written many unit tests for my course and they have all worked until today. Now suddenly none of them are working (even ones that previously did), and I am getting this error:
I haven’t changed anything in previously working files of unit tests and they are all now getting this error. It could be something in my code, but the code I have in the test is pretty straightforward and just calls a test function I have written:
It’s frustrating this is occurring now because my students are taking an exam tomorrow, and I like to give them unit tests to use on the programming portion of the exam and now it seems I won’t have that. Please let me know if there is a fix or if anyone else has gotten this error.
After much trial and error, I figured out the issue. The way the tests compile, it doesn’t like it if there is any comment or even blank lines after a function in the Advanced setup. I didn’t add anything to the tearDown() function, but there was a comment that gets auto-filled there and it was throwing an indentation error because of it. I deleted the comment and the tests work. This may be an issue that needs to be addressed though since I didn’t add that comment, it was already there by default and it was very difficult to pinpoint this issue.
I don’t remember this being an issue before, so I’m not sure why it was now, but removing the comment worked to fix the problem.