Skip to content

Commit

Permalink
Updated actions, removed flake8, fixed unused vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris committed Apr 26, 2024
1 parent 57a2ee2 commit 612ec7b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 66 deletions.
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pre_commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
timeout-minutes: 2

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
Expand Down
26 changes: 0 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,9 @@ repos:
- id: check-added-large-files
files: '\.py$'

- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
language_version: python3.9
files: '\.py$'
args:
- --line-length=120
- --exclude=staging_service/auth2Client.py
- --exclude=import_specifications/clients/baseclient\.py

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
args:
- --ignore=E203,W503
- --max-line-length=120
- --config=.flake8
files: '\.py$'
additional_dependencies: [ flake8 ]




- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.1
hooks:
- id: ruff
args:
- '--exclude=tests/test_app.py'
- '--exclude=import_specifications/clients/baseclient.py'
74 changes: 37 additions & 37 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ async def test_jbi_metadata():

async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_jgi.fastq"), txt)
f_jgi = fs.make_file(os.path.join(username, "test", ".test_jgi.fastq.jgi"), jbi_metadata)
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test_jgi.fastq"), txt)
fs.make_file(os.path.join(username, "test", ".test_jgi.fastq.jgi"), jbi_metadata)
res1 = await cli.get(
os.path.join("jgi-metadata", "test", "test_jgi.fastq"),
headers={"Authorization": ""},
Expand All @@ -230,8 +230,8 @@ async def test_metadata():
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
res1 = await cli.get(
os.path.join("metadata", "test", "test_file_1"),
headers={"Authorization": ""},
Expand Down Expand Up @@ -330,8 +330,8 @@ async def test_define_UPA():
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
# generating metadata file
res1 = await cli.get(
os.path.join("metadata", "test", "test_file_1"),
Expand Down Expand Up @@ -411,8 +411,8 @@ async def test_mv():
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test_file_1"), txt)

# list current test directory
res1 = await cli.get(os.path.join("list", "test"), headers={"Authorization": ""})
Expand Down Expand Up @@ -479,8 +479,8 @@ async def test_delete():
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test_file_1"), txt)

# list current test directory
res1 = await cli.get(os.path.join("list", "test"), headers={"Authorization": ""})
Expand Down Expand Up @@ -523,10 +523,10 @@ async def test_list():
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
d2 = fs.make_dir(os.path.join(username, "test", "test_sub_dir"))
f3 = fs.make_file(os.path.join(username, "test", "test_sub_dir", "test_file_2"), txt)
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
fs.make_dir(os.path.join(username, "test", "test_sub_dir"))
fs.make_file(os.path.join(username, "test", "test_sub_dir", "test_file_2"), txt)
res1 = await cli.get("list/..", headers={"Authorization": ""})
assert res1.status == 404
res2 = await cli.get(
Expand Down Expand Up @@ -572,7 +572,7 @@ async def test_list():
assert sum(file_folder_count) == 1

# testing list dot-files
f4 = fs.make_file(os.path.join(username, "test", ".test_file_1"), txt)
fs.make_file(os.path.join(username, "test", ".test_file_1"), txt)
# f5 = fs.make_file(os.path.join(username, 'test', '.globus_id'), txt)
res6 = await cli.get("/list/", headers={"Authorization": ""})
assert res6.status == 200
Expand Down Expand Up @@ -600,8 +600,8 @@ async def test_download(txt):
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test_file_1"), txt)

res = await cli.get(
os.path.join("download", "test", "test_file_1"),
Expand All @@ -616,7 +616,7 @@ async def test_download_errors():
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
fs.make_dir(os.path.join(username, "test"))

res1 = await cli.get("dwnload", headers={"Authorization": ""})
assert res1.status == 404
Expand All @@ -629,15 +629,15 @@ async def test_similar():
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_file_1.fq"), txt)
d1 = fs.make_dir(os.path.join(username, "test", "test_sub_dir"))
f1 = fs.make_file(os.path.join(username, "test", "test_sub_dir", "test_file_2.fq"), txt)
f2 = fs.make_file(
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test_file_1.fq"), txt)
fs.make_dir(os.path.join(username, "test", "test_sub_dir"))
fs.make_file(os.path.join(username, "test", "test_sub_dir", "test_file_2.fq"), txt)
fs.make_file(
os.path.join(username, "test", "test_sub_dir", "test_file_right.fq"),
txt,
)
f3 = fs.make_file(os.path.join(username, "test", "test_sub_dir", "my_files"), txt)
fs.make_file(os.path.join(username, "test", "test_sub_dir", "my_files"), txt)

# testing similar file name
res1 = await cli.get("similar/test/test_file_1.fq", headers={"Authorization": ""})
Expand All @@ -662,13 +662,13 @@ async def test_existence():
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
d2 = fs.make_dir(os.path.join(username, "test", "test_sub_dir"))
f3 = fs.make_file(os.path.join(username, "test", "test_sub_dir", "test_file_2"), txt)
d3 = fs.make_dir(os.path.join(username, "test", "test_sub_dir", "test_file_1"))
d4 = fs.make_dir(os.path.join(username, "test", "test_sub_dir", "test_sub_dir"))
f4 = fs.make_file(
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test_file_1"), txt)
fs.make_dir(os.path.join(username, "test", "test_sub_dir"))
fs.make_file(os.path.join(username, "test", "test_sub_dir", "test_file_2"), txt)
fs.make_dir(os.path.join(username, "test", "test_sub_dir", "test_file_1"))
fs.make_dir(os.path.join(username, "test", "test_sub_dir", "test_sub_dir"))
fs.make_file(
os.path.join(username, "test", "test_sub_dir", "test_sub_dir", "test_file_1"),
txt,
)
Expand Down Expand Up @@ -718,10 +718,10 @@ async def test_search():
username = "testuser"
async with AppClient(config, username) as cli:
with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test1"), txt)
d2 = fs.make_dir(os.path.join(username, "test", "test2"))
f3 = fs.make_file(os.path.join(username, "test", "test2", "test3"), txt)
fs.make_dir(os.path.join(username, "test"))
fs.make_file(os.path.join(username, "test", "test1"), txt)
fs.make_dir(os.path.join(username, "test", "test2"))
fs.make_file(os.path.join(username, "test", "test2", "test3"), txt)
res1 = await cli.get("search/", headers={"Authorization": ""})
assert res1.status == 200
json_text = await res1.text()
Expand All @@ -748,7 +748,7 @@ async def test_upload():
assert res1.status == 400

with FileUtil() as fs:
d = fs.make_dir(os.path.join(username, "test"))
fs.make_dir(os.path.join(username, "test"))
f = fs.make_file(os.path.join(username, "test", "test_file_1"), txt)

files = {"destPath": "/", "uploads": open(f, "rb")}
Expand Down

0 comments on commit 612ec7b

Please sign in to comment.