oracle / oracle/macaron

Use a temporary file for testing defaults.ini content loading in test_pypi_sourcecode_analyzer.py

Open
#1,108 0 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

tests
Dominant language
Python
Stars
210
Forks
36
Avg merge
1d 10h
Merged PRs (30d)
2

Description

Description

In this test module - https://github.com/oracle/macaron/blob/612e27ec347e7e073311b65a32b9eec8c6ba7d5c/tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py, we are mocking the defaults object to test some behaviors relating to some source code analysis configuration in defaults.ini.

Expectation

In this module https://github.com/oracle/macaron/blob/44dbf0acbd3dcb9f577db97b5c6876cfb8c87957/tests/config/test_defaults.py we put the defaults.ini content into a temporary file and load from it.
This is an example https://github.com/oracle/macaron/blob/44dbf0acbd3dcb9f577db97b5c6876cfb8c87957/tests/config/test_defaults.py#L103-L109

which can remove the need for mocking and keep the defaults.ini in the test definition itself. Perhaps we can rewrite the tests in test_pypi_sourcecode_analyzer.py to use this approach instead.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.