def test_autofix(self): with pytest.raises(SystemExit): main([str(self.test_file), "-i"]) expected = self.reference_file.read_text() obtained = self.test_file.read_text() for lexp, lobt in zip(expected.split(), obtained.split()): assert lexp == lobt
def test_stability(self): original = self.test_file.read_text() # Autofixing should be nilpotent with pytest.raises(SystemExit): main([str(self.test_file), "-i"]) first_pass = self.test_file.read_text() with pytest.raises(SystemExit): main([str(self.test_file), "-i"]) second_pass = self.test_file.read_text() assert first_pass == second_pass assert first_pass != original
def test_autofix_folder_or_file_do_not_exists(self): not_a_folder = self.WDIR # this will continue to append "subdir" to the working directory # until the directory does not exist while os.path.exists(not_a_folder) and os.path.isdir(not_a_folder): not_a_folder = os.path.join(not_a_folder, "subdir") with pytest.raises(FileNotFoundError): main([not_a_folder, "--stdout"]) # if the folder does fnot exist, this file should not either not_a_file = os.path.join(not_a_folder, "whatever.f90") with pytest.raises(FileNotFoundError): main([not_a_file, "--stdout"])
def test_fail_with_error(self): with pytest.raises(SystemExit): main([str(self.test_file), "--stdout"])