-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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,49 @@ | ||
from pathlib import Path | ||
from typing import Dict, List | ||
|
||
import pytest | ||
|
||
# Assuming the functions filter_issues and stub_ignore are in a module named 'mymodule' | ||
from snippets.test_snippets import stub_ignore | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"line, version, port, board, ignore", | ||
[ | ||
( | ||
"import espnow # stubs-ignore: version<1.21.0 or port.startswith('esp')", | ||
"1.21.0", | ||
"esp32", | ||
"", | ||
True, | ||
), | ||
( | ||
"import espnow # stubs-ignore: skip port.lower().startswith('pybd')", | ||
"1.21.0", | ||
"PYBD_SF6", | ||
"", | ||
True, | ||
), | ||
("import espnow # stubs-ignore: version < 1.21.0", "1.20.0", "esp32", "", True), | ||
("import espnow # stubs-ignore : version < 1.21.0", "1.20.0", "esp32", "", True), | ||
("import espnow # stubs-ignore :version<1.21.0", "1.20.0", "esp32", "", True), | ||
("import espnow # stubs-ignore:skip version < 1.21.0", "1.20.0", "esp32", "", True), | ||
("import espnow # stubs-ignore : skip version < 1.21.0", "1.20.0", "esp32", "", True), | ||
("import espnow # stubs-ignore :skip version<1.21.0", "1.20.0", "esp32", "", True), | ||
("version<1.21.0", "1.21.0", "esp32", "", False), | ||
("invalid condition", "1.21.0", "esp32", "", False), | ||
], | ||
) | ||
def test_stub_ignore(line, version, port, board, ignore): | ||
is_source = "#" in line | ||
assert ( | ||
stub_ignore( | ||
line, | ||
version, | ||
port, | ||
board, | ||
linter="pytest", | ||
is_source=is_source, | ||
) | ||
== ignore | ||
) |