MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / test_invalid_license_retry

Function test_invalid_license_retry

test/cli/premium_test.py:134–157  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

132
133
134def 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
160def test_help(tmpdir):

Callers

nothing calls this directly

Calls 3

cppcheckFunction · 0.90
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected