test: Do not write Python bytecode to source directory

This change prevents writing `share/rpcauth/__pycache__/*.pyc`, which is
especially useful for out-of-source builds when the source directory is
supposed to be read-only.
This commit is contained in:
Hennadii Stepanov 2024-07-26 17:46:15 +01:00
parent 30cef53707
commit c91a10b684
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 2 additions and 1 deletions

View file

@ -329,7 +329,7 @@ clean-docs:
clean-local: clean-docs
rm -rf coverage_percent.txt test_bitcoin.coverage/ total.coverage/ fuzz.coverage/ test/tmp/ cache/ $(OSX_APP)
rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache share/rpcauth/__pycache__
rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache
rm -rf dist/ test/lint/test_runner/target/ test/lint/__pycache__
test-security-check:

View file

@ -21,6 +21,7 @@ class TestRPCAuth(unittest.TestCase):
with open(config_path, encoding="utf8") as config_file:
config.read_file(config_file)
sys.path.insert(0, os.path.dirname(config['environment']['RPCAUTH']))
sys.dont_write_bytecode = True
self.rpcauth = importlib.import_module('rpcauth')
def test_generate_salt(self):