Problem:
If you are testing a setup.py file which references external files, synk test
will error with FileNotFoundError: No such file or directory error. For example setup.py generally refers to README.md external file.
Example:
"FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp-7067mnWAUQyFP0Va/README.md'\n"
Discussion:
This happens because Snyk CLI copies only the file that is being tested to a temp folder and not the files that are being referenced.
Resolution:
Remove the reference to external files in the code or simply comment them out before testing. An example:
# here = os.path.abspath(os.path.dirname(__file__))
# with codecs.open(os.path.join(here, 'README.md'), 'r', 'utf-8') as f:
# README = f.read()
# with codecs.open(os.path.join(here, 'CHANGES.txt'), 'r', 'utf-8') as f:
# CHANGES = f.read()
# long_description=README + '\n\n' + CHANGES