Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Added windows and mac to the matrix #84

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"] # can add windows-latest, macos-latest
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python: ["3.9", "3.10", "3.11"]
install: ["-e .[dev]"]
# Make one version be non-editable to test both paths of version code
Expand Down
6 changes: 3 additions & 3 deletions src/python3_pip_skeleton/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def replace_text(text: str) -> str:
return text

def replace_in_file(file_path: Path, text_from: str, text_to: str):
file_contents = file_path.read_text()
file_contents = file_path.read_text(encoding="utf8")
file_path.write_text(file_contents.replace(text_from, text_to))

branches = list_branches(path)
Expand Down Expand Up @@ -155,15 +155,15 @@ def replace_in_file(file_path: Path, text_from: str, text_to: str):
for relative_child in git_tmp("ls-files").splitlines():
child = Path(git_tmp.name) / relative_child
if child.suffix in CHANGE_SUFFIXES and child.name not in IGNORE_FILES:
text = replace_text(child.read_text())
text = replace_text(child.read_text(encoding="utf8"))
child.write_text(text)
# Replace the file, ignoring text between specified substrings
elif (
child.suffix in CHANGE_SUFFIXES
and child.name in IGNORE_FILES
and IGNORE_FILES[child.name]
):
original_text = child.read_text()
original_text = child.read_text(encoding="utf8")
ignore_sections = find_ignore_sections(
child.name, original_text, IGNORE_FILES[child.name]
)
Expand Down
21 changes: 16 additions & 5 deletions tests/test_adopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,23 @@ def test_new_module(extra_args, tmp_path: Path):
api_rst = module / "docs" / "user" / "reference" / "api.rst"
assert (
"Version number as calculated by https://github.com/pypa/setuptools_scm"
in api_rst.read_text()
in api_rst.read_text(encoding="utf8")
)
assert (module / "src" / "my_module").is_dir()
assert check_output("git", "branch", cwd=module).strip() == "* main"
check_output("python", "-m", "venv", "venv", cwd=module)
check_output("venv/bin/pip", "install", "--upgrade", "pip", cwd=module)
check_output("venv/bin/pip", "install", ".[dev]", cwd=module)
check_output(
"venv/bin/python",
"-m",
"pip",
"install",
"--upgrade",
"pip",
cwd=module,
)
check_output(
"venv/bin/python", "-m", "pip", "install", ".[dev]", cwd=module
)
check_output(
"venv/bin/python",
"-m",
Expand Down Expand Up @@ -138,8 +148,9 @@ def test_new_module_merge_from_valid_branch(tmp_path: Path):
# Test basic functionality
assert (module / "src" / "my_module").is_dir()
check_output("python", "-m", "venv", "venv", cwd=module)
check_output("venv/bin/pip", "install", ".[dev]", cwd=module)

check_output(
"venv/bin/python", "-m", "pip", "install", ".[dev]", cwd=module
)

def test_new_module_merge_from_invalid_branch(tmp_path: Path):
module = tmp_path / "my-module"
Expand Down