Skip to content

Commit

Permalink
Feature/cli setup param (#50)
Browse files Browse the repository at this point in the history
* add `--param` arg to the CLI handler

* add more CLI test to the github workflow

* CHANGELOG.md updated
  • Loading branch information
AHReccese authored Aug 16, 2024
1 parent 113bd91 commit 822387e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install .
- name: Smoke test
- name: CLI Tests - Version Check
run: |
python -m reserver --version
reserver --version
- name: CLI Tests - Invalid Token
run: |
python -m reserver --token "invalid_token" --test --name numpy
reserver --token "invalid_token" --test --name numpy
- name: CLI Tests - Valid Token + Invalid Name (already taken)
run: |
python -m reserver --token "${{ secrets.TEST_PYPI_PASSWORD }}" --test --name numpy
reserver --token "${{ secrets.TEST_PYPI_PASSWORD }}" --test --name numpy
- name: Test requirements Installation
run: |
python otherfiles/requirements-splitter.py
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
### Added
- CLI tests added
- `param` arg in CLI Handler
- more testcases in conflict cases
- `batch_upload` tests
- `read_json` method in `util.py`
Expand Down
12 changes: 10 additions & 2 deletions reserver/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'--name',
nargs='?',
nargs='*',
type=str,
metavar="PACKAGE_NAME",
help='Name(s) to get reserved',
)
parser.add_argument(
'--param',
nargs='*',
type=str,
metavar="PACKAGE_PARAM",
help='Path to JSON file(s) containing package(s) parameters to set',
)
parser.add_argument(
'--token',
nargs='?',
Expand All @@ -36,10 +43,11 @@ def main():
print(RESERVER_VERSION)
return
names = args.name
params = args.param
test_pypi = args.test
pypi_token = args.token
if names and pypi_token:
PyPIUploader(pypi_token, test_pypi).batch_upload(names)
PyPIUploader(pypi_token, test_pypi).batch_upload(names, params)
else:
tprint("Reserver")
tprint("V:" + RESERVER_VERSION)
Expand Down

0 comments on commit 822387e

Please sign in to comment.