| 132 | |
| 133 | |
| 134 | def test_invalid_license_retry(tmpdir): |
| 135 | # Trac 13832 - cppcheck build dir: do not reuse cached results if there were invalidLicense errors |
| 136 | build_dir = os.path.join(tmpdir, 'b') |
| 137 | test_file = os.path.join(tmpdir, 'test.c') |
| 138 | addon_file = os.path.join(tmpdir, 'premiumaddon.py') |
| 139 | |
| 140 | os.mkdir(build_dir) |
| 141 | |
| 142 | with open(test_file, 'wt') as f: |
| 143 | f.write('void foo();\n') |
| 144 | |
| 145 | args = [f"--addon={addon_file}", f"--cppcheck-build-dir={build_dir}", '--xml', '--enable=all', test_file] |
| 146 | |
| 147 | with open(addon_file, 'wt') as f: |
| 148 | f.write('print(\'{"addon":"premium","column":0,"errorId":"invalidLicense","extra":"","file":"Cppcheck Premium","linenr":0,"message":"Invalid license: No license file was found, contact sales@cppchecksolutions.com","severity":"error"}\')') |
| 149 | |
| 150 | _, _, stderr = cppcheck(args) |
| 151 | assert 'Invalid license' in stderr |
| 152 | |
| 153 | with open(addon_file, 'wt') as f: |
| 154 | f.write('') |
| 155 | |
| 156 | _, _, stderr = cppcheck(args) |
| 157 | assert 'Invalid license' not in stderr |
| 158 | |
| 159 | |
| 160 | def test_help(tmpdir): |