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

[Sweep Rules] Add Unit Tests #36

Closed
wants to merge 5 commits into from
Closed

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Nov 4, 2023

PR Feedback (click)

  • 👍 Sweep Did Well
  • 👎 Sweep Needs Improvement

I created this PR to address this rule:

"Code should always include unit tests."

Description

This PR adds unit tests to the PullingAce library to ensure the correctness of its functionality. The README.md file primarily contains instructions for using the library, so the tests have been added to the relevant Python scripts in the pulling_ace directory.

Summary of Changes

  • Created a new test script test_tomato_attack.py to test the pulling_ace.attacks.tomato_attack module.
  • Created a new test script test_word_embedding_attack.py to test the pulling_ace.attacks.word_embedding_attack module.
  • Created a new test script test_check_comp.py to test the pulling_ace.utils.check_comp module.
  • Created a new test script test_subprocessor.py to test the pulling_ace.utils.subprocessor module.

These tests cover the important functionality of the PullingAce library and ensure its robustness.

Copy link
Contributor Author

sweep-ai bot commented Nov 4, 2023

Rollback Files For Sweep

  • Rollback changes to test/test_subprocessor.py
  • Rollback changes to test/test_subprocessor.py
  • Rollback changes to .trunk/trunk.yaml
  • Rollback changes to .trunk/trunk.yaml

@sweep-ai sweep-ai bot added the sweep label Nov 4, 2023
Copy link
Contributor Author

sweep-ai bot commented Nov 4, 2023

Sandbox Executions

  • Check test/test_tomato_attack.py
Run `test/test_tomato_attack.py` through the sandbox.
  • Check test/test_word_embedding_attack.py
Run `test/test_word_embedding_attack.py` through the sandbox.
  • Check test/test_check_comp.py
Run `test/test_check_comp.py` through the sandbox.
  • Check test/test_subprocessor.py
Sandbox logs for
pre-commit install 1/2 ✓
pre-commit installed at .git/hooks/pre-commit
trunk init 2/2 ❌ (`1`)
✘ Invalid .trunk/trunk.yaml, no cli version found. See https://docs.trunk.io for more info.
  • Check .trunk/trunk.yaml
Sandbox logs for
pre-commit install 1/2 ✓
pre-commit installed at .git/hooks/pre-commit
trunk init 2/2 ❌ (`1`)
✘ Invalid .trunk/trunk.yaml, no cli version found. See https://docs.trunk.io for more info.
  • Check test/test_subprocessor.py
Sandbox logs for
pre-commit install 1/2 ✓
pre-commit installed at .git/hooks/pre-commit
trunk init 2/2 ❌ (`1`)
✘ Invalid .trunk/trunk.yaml, no cli version found. See https://docs.trunk.io for more info.

Copy link
Contributor Author

sweep-ai bot commented Nov 4, 2023

The command:
Run pipenv run black --check .
yielded the following error:
`##[error]Process completed with exit code 1.
##[group]Run docker build . -t pulling_ace:test
�[36;1mdocker build . -t pulling_ace:test�[0m
shell: /usr/bin/bash -e {0}
##[endgroup]
#0 building with "default" instance using docker driver

#1 [internal] load .dockerignore
#1 transferring context: 145B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.16kB done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/python:3.10-slim
#3 ...

#4 [auth] library/python:pull token for registry-1.docker.io
#4 DONE 0.0s

#3 [internal] load metadata for docker.io/library/python:3.10-slim
#3 DONE 1.0s

#5 [internal] load build context
#5 transferring context: 170.52kB done
#5 DONE 0.0s

#6 [base 1/1] FROM docker.io/library/python:3.10-slim@sha256:3c9182c6498d7de6044be04fb1785ba3a04f953d515d45e5007e8be1c15fdd34
#6 resolve docker.io/library/python:3.10-slim@sha256:3c9182c6498d7de6044be04fb1785ba3a04f953d515d45e5007e8be1c15fdd34 done
#6 sha256:578acb154839e9d0034432e8f53756d6f53ba62cf8c7ea5218a2476bf5b58fc9 0B / 29.15MB 0.1s
#6 sha256:ac65017cfc5699a3ab0e5ed6e11c321fc0c664fd6b4c8744cda7914e74897c47 0B / 3.51MB 0.1s
#6 sha256:146269b80f9cf49d0a8468344c664ea4368c54f4a53f9aa61ebf626adf0d2836 0B / 12.38MB 0.1s
#6 sha256:3c9182c6498d7de6044be04fb1785ba3a04f953d515d45e5007e8be1c15fdd34 1.65kB / 1.65kB done
#6 sha256:9a5af4ca0c7678180db9bab26506d0f8959e5a6c32cc5349b7bdcd712790c0f3 1.37kB / 1.37kB done
#6 sha256:578acb154839e9d0034432e8f53756d6f53ba62cf8c7ea5218a2476bf5b58fc9 4.19MB / 29.15MB 0.2s
#6 sha256:a9e021b7cfa1ac0b0cb401c04110e523878b46276735710ce120f940e9523700 6.94kB / 6.94kB done
#6 sha256:578acb154839e9d0034432e8f53756d6f53ba62cf8c7ea5218a2476bf5b58fc9 18.87MB / 29.15MB 0.4s
#6 sha256:ac65017cfc5699a3ab0e5ed6e11c321fc0c664fd6b4c8744cda7914e74897c47 2.10MB / 3.51MB 0.4s
#6 sha256:146269b80f9cf49d0a8468344c664ea4368c54f4a53f9aa61ebf626adf0d2836 12.38MB / 12.38MB 0.4s done
#6 sha256:b51bc62cc3ca2211d3e3882aba56cf7054c9773c535f198676c0ce429d29ef78 0B / 245B 0.4s
#6 sha256:578acb154839e9d0034432e8f53756d6f53ba62cf8c7ea5218a2476bf5b58fc9 29.15MB / 29.15MB 0.5s done
#6 sha256:ac65017cfc5699a3ab0e5ed6e11c321fc0c664fd6b4c8744cda7914e74897c47 3.51MB / 3.51MB 0.4s done
#6 sha256:b51bc62cc3ca2211d3e3882aba56cf7054c9773c535f198676c0ce429d29ef78 245B / 245B 0.5s done
#6 sha256:4ba34dd48a55b7d0c548e1c74b1d1e4b2145c50f4ae760378734c13ae4529c50 0B / 3.37MB 0.5s
#6 extracting sha256:578acb154839e9d0034432e8f53756d6f53ba62cf8c7ea5218a2476bf5b58fc9
#6 sha256:4ba34dd48a55b7d0c548e1c74b1d1e4b2145c50f4ae760378734c13ae4529c50 3.37MB / 3.37MB 0.5s done
#6 extracting sha256:578acb154839e9d0034432e8f53756d6f53ba62cf8c7ea5218a2476bf5b58fc9 1.0s done
#6 extracting sha256:ac65017cfc5699a3ab0e5ed6e11c321fc0c664fd6b4c8744cda7914e74897c47
#6 extracting sha256:ac65017cfc5699a3ab0e5ed6e11c321fc0c664fd6b4c8744cda7914e74897c47 0.1s done
#6 extracting sha256:146269b80f9cf49d0a8468344c664ea4368c54f4a53f9aa61ebf626adf0d2836
#6 extracting sha256:146269b80f9cf49d0a8468344c664ea4368c54f4a53f9aa61ebf626adf0d2836 0.4s done
#6 extracting sha256:b51bc62cc3ca2211d3e3882aba56cf7054c9773c535f198676c0ce429d29ef78 done
#6 extracting sha256:4ba34dd48a55b7d0c548e1c74b1d1e4b2145c50f4ae760378734c13ae4529c50 0.1s
#6 extracting sha256:4ba34dd48a55b7d0c548e1c74b1d1e4b2145c50f4ae760378734c13ae4529c50 0.2s done
#6 DONE 2.7s

#7 [python-deps 1/8] COPY Pipfile Pipfile.lock /app/
#7 DONE 0.0s

#8 [python-deps 2/8] COPY . /app
#8 DONE 0.0s

#9 [python-deps 3/8] WORKDIR /app
#9 DONE 0.0s

#10 [python-deps 4/8] RUN pipenv install --deploy
#10 0.210 /bin/sh: 1: pipenv: not found
#10 ERROR: process "/bin/sh -c pipenv install --deploy" did not complete successfully: exit code: 127

[python-deps 4/8] RUN pipenv install --deploy:
0.210 /bin/sh: 1: pipenv: not found


Dockerfile:16

14 | COPY . /app
15 | WORKDIR /app
16 | >>> RUN pipenv install --deploy
17 | # Set the working directory to /app
18 | WORKDIR /app

ERROR: failed to solve: process "/bin/sh -c pipenv install --deploy" did not complete successfully: exit code: 127
##[error]Process completed with exit code 1.`
Here are the logs:

would reformat test/test_subprocessor.py

Oh no! 💥 💔 💥
1 file would be reformatted, 20 files would be left unchanged.

Copy link
Contributor Author

sweep-ai bot commented Nov 4, 2023

🚀 Wrote Changes

Done.

@sweep-ai sweep-ai bot closed this Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant