-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run unit tests for Python3.11 exclude hive extra from it because of issue cloudera/python-sasl#30
- Loading branch information
1 parent
d5d208f
commit f181cd8
Showing
7 changed files
with
109 additions
and
10 deletions.
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
35 changes: 35 additions & 0 deletions
35
.circleci/scripts/pre_commit_setup_cfg_python_3_11_all_extra.py
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,35 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Pre-commit hook to sync an all Python3.11 extra in setup.cfg. | ||
It will contain all the dependencies apart from tests and mypy. | ||
""" | ||
import configparser | ||
from pathlib import Path | ||
|
||
repo_dir = Path(__file__).parent.parent.parent | ||
|
||
config = configparser.ConfigParser(strict=False) | ||
config.read(repo_dir / "setup.cfg") | ||
|
||
all_extra = [] | ||
extra_to_exclude = {"tests", "mypy", "docs", "all", "test_python_3_11", "apache.hive"} | ||
for k in config["options.extras_require"].keys(): | ||
if k in extra_to_exclude: | ||
continue | ||
reqs = config["options.extras_require"][k].split() | ||
all_extra.extend(reqs) | ||
|
||
expected_all_extra = set(all_extra) | ||
found_all_extra = set(config["options.extras_require"].get("test_python_3_11", "").split()) | ||
|
||
if not found_all_extra: | ||
raise SystemExit("Missing 'all' extra in setup.cfg") | ||
|
||
""" | ||
Use XOR operator ^ to find the missing dependencies instead of set A - set B | ||
set A - set B will only show difference of set A from set B, but we want see overall diff | ||
""" | ||
diff_extras = expected_all_extra ^ found_all_extra | ||
if diff_extras: | ||
diff_extras_str = "\n \t" + "\n \t".join(sorted(diff_extras)) | ||
raise SystemExit(f"'all' extra in setup.cfg is missing some dependencies:\n {diff_extras_str}") |
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
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