Browse Source

ran black over files

atomic-pr-id-python
Joseph Flinn 2 years ago
parent
commit
53214d3aa1
No known key found for this signature in database
GPG Key ID: B7E429D4A0FBD2A0
  1. 2
      .github/jobs-py/src/get_pr_id.py
  2. 13
      .github/jobs-py/tests/e2e/test_get_pr_id.py
  3. 3
      .github/jobs-py/tests/unit/context.py

2
.github/jobs-py/src/get_pr_id.py

@ -29,7 +29,7 @@ def get_pr_id(commit_sha: str) -> int | None: @@ -29,7 +29,7 @@ def get_pr_id(commit_sha: str) -> int | None:
if __name__ == "__main__":
if len(sys.argv) < 2:
print(f'[!] Please pass in commit hash: {sys.argv}')
print(f"[!] Please pass in commit hash: {sys.argv}")
exit(1)
print(get_pr_id(sys.argv[1]))

13
.github/jobs-py/tests/e2e/test_get_pr_id.py

@ -3,17 +3,14 @@ import subprocess @@ -3,17 +3,14 @@ import subprocess
def test_get_pr_id_cmd():
inputs = [
{'commit': '7d46c75af91adbfdfc70689f4d8b3405b26bda6b', 'expected': '196'},
{'commit': 'f30be53c2a5b3d61928c0f41a2e25605a9901d6a', 'expected': 'None'},
{'commit': 'f30be53c2a5b3d61928c0f41a2e25605a9901d6b', 'expected': 'None'}
{"commit": "7d46c75af91adbfdfc70689f4d8b3405b26bda6b", "expected": "196"},
{"commit": "f30be53c2a5b3d61928c0f41a2e25605a9901d6a", "expected": "None"},
{"commit": "f30be53c2a5b3d61928c0f41a2e25605a9901d6b", "expected": "None"},
]
for input in inputs:
result = subprocess.run(
['python', 'src/get_pr_id.py', input["commit"]],
stdout=subprocess.PIPE
["python", "src/get_pr_id.py", input["commit"]], stdout=subprocess.PIPE
)
assert result.stdout.decode().strip('\n') == input['expected']
assert result.stdout.decode().strip("\n") == input["expected"]

3
.github/jobs-py/tests/unit/context.py

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
import src

Loading…
Cancel
Save