Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

By default avoiding generating files in temp directory #329

Merged
merged 7 commits into from
Jun 12, 2023

Conversation

dbogunowicz
Copy link
Contributor

@dbogunowicz dbogunowicz commented Jun 6, 2023

Changes

  1. Added the conftests so that after running any test target, the total size of files created after running the test suite can be: zero mb for the root directory, and up to 1mb for the temp directory.

  2. Audited the most important paths for /src and /tests

  3. Audit Plan

Auditing the pathways that contain keywords: tempfile and download to make sure that we are not being sloppy with saving or downloading files to the temporary directory.

Auditing the /src

find . -name "*.py" -type f -exec grep -l "download" {} +

./sparsezoo/objects/directories.py - validated
./sparsezoo/objects/directory.py - validated
./sparsezoo/objects/file.py - validated
./sparsezoo/download_main.py - validated
./sparsezoo/main.py - validated
./sparsezoo/deployment_package/cli.py - validated
./sparsezoo/model/utils.py - validated
./sparsezoo/model/model.py - validated
./sparsezoo/utils/download.py - validated
./sparsezoo/utils/__init__.py - validated
find . -name "*.py" -type f -exec grep -l "tempfile" {} +

>>

Auditing the /tests

Note: I consider saving to tempfile benign if it is either done within a context (using a context manager), or using the tmp_path fixture or factory within the pytest framework.

 find . -name "*.py" -type f -exec grep -l "tempfile" {} +

./sparsezoo/objects/test_directory.py - validated
./sparsezoo/objects/test_directories.py - validated
./sparsezoo/objects/test_file.py - validated
./sparsezoo/model/test_utils.py - validated
./sparsezoo/model/test_model.py

 find . -name "*.py" -type f -exec grep -l "download" {} +

./sparsezoo/deployment_package/test_cli.py - validated
./sparsezoo/model/test_utils.py - validated
./sparsezoo/model/test_model.py - validated
./sparsezoo/api/test_graphql.py - validated

@dbogunowicz dbogunowicz requested a review from KSGulin June 12, 2023 10:27
@dbogunowicz dbogunowicz merged commit f053d93 into main Jun 12, 2023
@dbogunowicz dbogunowicz deleted the feature/damian/test_fix branch June 12, 2023 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants