This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from DiamondLightSource/add_windows_and_mac_to…
…_matrix added other OS to the matrix
- Loading branch information
Showing
7 changed files
with
99 additions
and
16 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
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
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,66 @@ | ||
""" | ||
This file checks that all the example boilerplate text has been removed. | ||
It can be deleted when all the contained tests pass. | ||
We include it in the skeleton-cli to ensure it passes for windows and macOS too. | ||
""" | ||
import sys | ||
from pathlib import Path | ||
|
||
if sys.version_info < (3, 8): | ||
from importlib_metadata import metadata # noqa | ||
else: | ||
from importlib.metadata import metadata # noqa | ||
|
||
ROOT = Path(__file__).parent.parent | ||
|
||
|
||
def skeleton_check(check: bool, text: str): | ||
if ROOT.name == "python3-pip-skeleton" or str(ROOT) == "/project": | ||
# In the skeleton module the check should fail | ||
check = not check | ||
text = f"Skeleton didn't raise: {text}" | ||
if check: | ||
raise AssertionError(text) | ||
|
||
|
||
def assert_not_contains_text(path: str, text: str, explanation: str): | ||
full_path = ROOT / path | ||
if full_path.exists(): | ||
contents = full_path.read_text().replace("\n", " ") | ||
skeleton_check(text in contents, f"Please change ./{path} {explanation}") | ||
|
||
|
||
# pyproject.toml | ||
def test_module_summary(): | ||
summary = metadata("python3-pip-skeleton")["summary"] | ||
skeleton_check( | ||
"One line description of your module" in summary, | ||
"Please change project.description in ./pyproject.toml " | ||
"to be a one line description of your module", | ||
) | ||
|
||
|
||
# README | ||
def test_changed_README_intro(): | ||
assert_not_contains_text( | ||
"README.rst", | ||
"This is where you should write a short paragraph", | ||
"to include an intro on what your module does", | ||
) | ||
|
||
|
||
def test_removed_adopt_skeleton(): | ||
assert_not_contains_text( | ||
"README.rst", | ||
"This project contains template code only", | ||
"remove the note at the start", | ||
) | ||
|
||
|
||
def test_changed_README_body(): | ||
assert_not_contains_text( | ||
"README.rst", | ||
"This is where you should put some images or code snippets", | ||
"to include some features and why people should use it", | ||
) |