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

Dev #584

Merged
merged 3 commits into from
Nov 3, 2024
Merged

Dev #584

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
upload-coverage:
needs: checks
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
7 changes: 6 additions & 1 deletion aiotus/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def main() -> int:
if sys.executable:
interpreter = os.path.basename(sys.executable)
else:
interpreter = "python3"
interpreter = "python3" # pragma: no cover

parser = argparse.ArgumentParser(prog=f"{interpreter} -m aiotus")
parser.add_argument("--debug", action="store_true", help="log debug messages")
Expand Down Expand Up @@ -107,4 +107,9 @@ def main() -> int:
else:
logging.basicConfig(level=logging.INFO)

if not hasattr(args, "func"):
sys.stderr.write("No command specified.\n\n")
parser.print_help(file=sys.stderr)
return 1

return args.func(args) # type: ignore
2 changes: 1 addition & 1 deletion aiotus/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ async def upload_multiple(
final_headers = dict(headers or {})
final_headers.update({"Upload-Concat": concat_header})

async for attempt in retrying_create:
async for attempt in retrying_create: # pragma: no branch
with attempt:
return await creation.create(
session,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ requires = [
[tool.coverage.run]
branch = true
relative_files = true
omit = ["aiotus/__main__.py"]

[tool.isort]
include_trailing_comma = true
Expand Down
9 changes: 9 additions & 0 deletions tests/test_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@


class TestAiotusClients:
def test_no_command(self):
with unittest.mock.patch("sys.argv", [""]):
with unittest.mock.patch("sys.stderr", new_callable=io.StringIO):
assert 1 == aiotus.entrypoint.main()

lines = sys.stderr.getvalue().splitlines(False)
assert len(lines) >= 0
assert lines[0] == "No command specified."

def test_aiotus_clients(self, tusd):
conf = aiotus.RetryConfiguration(1, 0.001, None)
defaults = (None, None, conf, None, 4 * 1024 * 1024)
Expand Down
Loading