-
Notifications
You must be signed in to change notification settings - Fork 650
Add __del__
method to BusABC
#1489
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a615878
Add del method
f9ebbac
Add unittest
60cb71b
Satisfy black formatter
9b0587d
Satisfy pylint linter
545c2f4
PR feedback
Tbruno25 16fd7b9
PR feedback
Tbruno25 90a29da
Move to cls attribute
18e457e
Add unittest
a598559
Call parent shutdown from socketcand
a779b91
Wrap del in try except
8dbd73c
Call parent shutdown from ixxat
248d64c
Black & pylint
468db05
PR feedback
Tbruno25 692b2e5
Remove try/except & fix ordering
c0d5ae1
Fix unittest
90d10a8
Call parent shutdown from etas
e3f2f6e
Add warning filter
ce144c0
Merge branch 'develop' into tj/1488_use-del
Tbruno25 c1980f3
Merge branch 'develop' into tj/1488_use-del
Tbruno25 3a528bf
Merge branch 'develop' into tj/1488_use-del
felixdivo 42c2ea4
Make multicast_udp back2back test more specific
felixdivo 40b684d
clean up test_interface_canalystii.py
felixdivo 861980c
carry over from #1519
zariiii9003 3aef905
fix AttributeError
zariiii9003 644c85d
Merge branch 'develop' into tj/1488_use-del
zariiii9003 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import importlib | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
import can | ||
from can.interfaces import BACKENDS | ||
|
||
|
||
@pytest.fixture(params=(BACKENDS.keys())) | ||
def constructor(request): | ||
mod, cls = BACKENDS[request.param] | ||
|
||
try: | ||
module = importlib.import_module(mod) | ||
constructor = getattr(module, cls) | ||
except: | ||
pytest.skip("Unable to load interface") | ||
|
||
return constructor | ||
|
||
|
||
@pytest.fixture | ||
def interface(constructor): | ||
with patch.object(constructor, "__init__", return_value=None): | ||
return constructor() | ||
|
||
|
||
@patch.object(can.bus.BusABC, "shutdown") | ||
def test_all_interfaces_call_parent_shutdown(mock_shutdown, interface): | ||
try: | ||
interface.shutdown() | ||
except: | ||
pass | ||
finally: | ||
mock_shutdown.assert_called() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.