forked from bskinn/sphobjinv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- ci: azure-pipelines coverage report omit setup.py - ci: azure-pipelines need --testall to get 100% coverage - ci: README.md affected by version. Update version - test: WorkDir - test: conftest fixture ensure_doc_scratch
- Loading branch information
1 parent
cc015fa
commit 489a99a
Showing
12 changed files
with
89 additions
and
31 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
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 |
---|---|---|
|
@@ -85,11 +85,11 @@ def func(path_cwd): | |
|
||
# On Windows, resolved executables paths | ||
resolved_soi_textconv_path = shutil.which(soi_textconv_path) | ||
if resolved_soi_textconv_path is None: | ||
if resolved_soi_textconv_path is None: # pragma: no cover | ||
resolved_soi_textconv_path = soi_textconv_path | ||
val = resolved_soi_textconv_path | ||
|
||
if is_win: | ||
if is_win: # pragma: no cover | ||
# On Windows, extensions Windows searches to find executables | ||
msg_info = f"""PATHEXT: {os.environ.get("PATHEXT", None)}""" | ||
logger_.info(msg_info) | ||
|
@@ -111,7 +111,7 @@ def func(path_cwd): | |
reason = f"Unable to set git config setting {key} to {val}" | ||
assert is_success is True, reason | ||
|
||
if is_win: | ||
if is_win: # pragma: no cover | ||
# .git/config after update | ||
gc_contents = path_git_config_dst.read_text() | ||
msg_info = f""".git/config (after update):{os.linesep}{gc_contents}""" | ||
|
@@ -123,6 +123,38 @@ def func(path_cwd): | |
class TestTextconvIntegration: | ||
"""Prove git diff an compare |objects.inv| files.""" | ||
|
||
def test_workdir( | ||
self, | ||
scratch_path, | ||
): | ||
"""Test interface of WorkDir.""" | ||
path_cwd = scratch_path | ||
wd = WorkDir(path_cwd) | ||
|
||
# __repr__ | ||
assert len(repr(wd)) != 0 | ||
|
||
# run fail | ||
cmd = "dsfsadfdsfsadfdsaf" | ||
assert run(cmd) is None | ||
|
||
wd("git init") | ||
wd("git config user.email [email protected]") | ||
wd('git config user.name "a test"') | ||
|
||
# From .git/config get nonexistent key | ||
invalid_key = "diff.sigfault.textconv" | ||
assert wd.git_config_get(invalid_key) is None | ||
|
||
# Write bytes and str data to file | ||
fname = "a.txt" | ||
write_these = ( | ||
b"aaaaa", | ||
"aaaaa", | ||
) | ||
for contents in write_these: | ||
wd.write(fname, contents) | ||
|
||
def test_textconv_git_diff( | ||
self, | ||
caplog, | ||
|
@@ -166,7 +198,7 @@ def test_textconv_git_diff( | |
if is_win or is_linux: | ||
msg_info = f"cwd {wd.cwd!s}" | ||
logger.info(msg_info) | ||
if is_win: | ||
if is_win: # pragma: no cover | ||
from pathlib import WindowsPath | ||
|
||
soi_textconv_path = "sphobjinv-textconv" | ||
|
@@ -229,12 +261,12 @@ def test_textconv_git_diff( | |
|
||
# Diagnostics before assertions | ||
# On error, not showing locals, so print source file and diff | ||
if is_win or is_linux: | ||
if is_win or is_linux: # pragma: no cover | ||
msg_info = f"cmd: {cmd}" | ||
logger.info(msg_info) | ||
msg_info = f"diff: {out}" | ||
logger.info(msg_info) | ||
if retcode != 0: | ||
if retcode != 0: # pragma: no cover | ||
msg_info = f"err: {err}" | ||
logger.info(msg_info) | ||
msg_info = f"regex: {expected_diff}" | ||
|
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