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

vlc: catch errors when instanciating vlc in is_available #124

Merged
merged 3 commits into from
May 11, 2024

Conversation

odrling
Copy link
Contributor

@odrling odrling commented Mar 25, 2024

This would make the tests fail on a system without VLC installed. Detecting it in is_available skips the tests.

For reference this is the error I get:

Traceback (most recent call last):
  File "/home/odrling/git/misc/dakara-player/src/dakara_player/media_player/vlc.py", line 94, in is_available
    return vlc is not None and vlc.Instance() is not None
                               ^^^^^^^^^^^^^^
  File "/home/odrling/git/misc/dakara-player/.direnv/python-3.12/lib/python3.12/site-packages/vlc.py", line 1838, in __new__
    return libvlc_new(len(args), args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odrling/git/misc/dakara-player/.direnv/python-3.12/lib/python3.12/site-packages/vlc.py", line 5014, in libvlc_new
    _Cfunction('libvlc_new', ((1,), (1,),), class_result(Instance),
  File "/home/odrling/git/misc/dakara-player/.direnv/python-3.12/lib/python3.12/site-packages/vlc.py", line 302, in _Cfunction
    raise NameError('no function %r' % (name,))
NameError: no function 'libvlc_new'

This would make the tests fail on a system without VLC installed.
Detecting it in is_available skips the tests.

For reference this is the error I get:
```
Traceback (most recent call last):
  File "/home/odrling/git/misc/dakara-player/src/dakara_player/media_player/vlc.py", line 94, in is_available
    return vlc is not None and vlc.Instance() is not None
                               ^^^^^^^^^^^^^^
  File "/home/odrling/git/misc/dakara-player/.direnv/python-3.12/lib/python3.12/site-packages/vlc.py", line 1838, in __new__
    return libvlc_new(len(args), args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odrling/git/misc/dakara-player/.direnv/python-3.12/lib/python3.12/site-packages/vlc.py", line 5014, in libvlc_new
    _Cfunction('libvlc_new', ((1,), (1,),), class_result(Instance),
  File "/home/odrling/git/misc/dakara-player/.direnv/python-3.12/lib/python3.12/site-packages/vlc.py", line 302, in _Cfunction
    raise NameError('no function %r' % (name,))
NameError: no function 'libvlc_new'
```
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.04%. Comparing base (f6e52f0) to head (611323a).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #124   +/-   ##
========================================
  Coverage    99.04%   99.04%           
========================================
  Files           16       16           
  Lines         1362     1366    +4     
========================================
+ Hits          1349     1353    +4     
  Misses          13       13           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@odrling odrling force-pushed the vlc-is-available-error branch from 99d9c71 to 255148c Compare March 25, 2024 21:59
@Neraste Neraste merged commit 45add8e into DakaraProject:develop May 11, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants