Skip to content

Commit

Permalink
CLI error message (#48)
Browse files Browse the repository at this point in the history
* fix : minor edit in play_cli function

* fix : codecov section updated

* fix : fast-fail disabled

* fix : function_test.py updated

* fix : error_test.py updated

* fix : sys.exit(0) removed from play_cli function

* doc : CHANGELOG.md updated

* fix : minor bug in tests fixed

* fix : minor edit in codecov.yml

* fix : codecov.yml bug fixed

* fix : macOS version changed from 11 to 13
  • Loading branch information
sepandhaghighi committed May 24, 2024
1 parent c730633 commit 3c26c92
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/linux_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0, 3.12.0]
Expand Down Expand Up @@ -54,9 +55,10 @@ jobs:
sudo python -m pydocstyle -v --match-dir=nava
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Version check
run: |
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/macOS_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ jobs:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-12, macOS-11]
os: [macOS-12, macOS-13]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0, 3.12.0]
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -44,7 +45,8 @@ jobs:
python -m pydocstyle -v --match-dir=nava
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
if: matrix.python-version == env.TEST_PYTHON_VERSION
6 changes: 4 additions & 2 deletions .github/workflows/windows_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-2019]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0, 3.12.0]
Expand Down Expand Up @@ -59,7 +60,8 @@ jobs:
python -m pydocstyle -v --match-dir=nava
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
if: matrix.python-version == env.TEST_PYTHON_VERSION
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- `main` function updated
- OSs local checklist added to pull request template
- Test system modified
- `README.md` modified
## [0.5] - 2024-04-03
### Changed
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
codecov:
require_ci_to_pass: yes
notify:
notify:
after_n_builds: 3
wait_for_ci: yes

Expand Down
5 changes: 3 additions & 2 deletions nava/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def play_cli(sound_path, loop=False):
play(sound_path)
if not loop:
break
except KeyboardInterrupt:
except NavaBaseError as e:
print("Error: {0}".format(e))
finally:
stop_all()
sys.exit(0)
3 changes: 3 additions & 0 deletions test/error_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
Traceback (most recent call last):
...
nava.errors.NavaBaseError: `loop` can not be set True when `async_mode` is False.
>>> import nava
>>> nava.functions.play_cli("test2.wav")
Error: Given sound file doesn't exist.
"""
1 change: 1 addition & 0 deletions test/function_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
True
>>> nava.params._play_threads_counter == 44
True
>>> nava.functions.play_cli(os.path.join("others", "test.wav"))
>>> nava.functions.nava_help()
<BLANKLINE>
A Python library for playing sound everywhere natively and securely.
Expand Down

0 comments on commit 3c26c92

Please sign in to comment.