Skip to content

Commit edc882a

Browse files
adam-grant-hendryLee-W
authored andcommitted
test(conf.py): remove os.linesep
This should be used when parsing binary files, not text streams. The regular expression fails on Windows because the stream contains `\n`, but `os.linesep` is `\r\n`. For reference, see https://stackoverflow.com/questions/38074811/what-is-os-linesep-for
1 parent ebf5e41 commit edc882a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def tmp_commitizen_project(tmp_git_project):
2828
def _get_gpg_keyid(signer_mail):
2929
_new_key = cmd.run(f"gpg --list-secret-keys {signer_mail}")
3030
_m = re.search(
31-
rf"[a-zA-Z0-9 \[\]-_]*{os.linesep}[ ]*([0-9A-Za-z]*){os.linesep}[{os.linesep}a-zA-Z0-9 \[\]-_<>@]*",
31+
r"[a-zA-Z0-9 \[\]-_]*\n[ ]*([0-9A-Za-z]*)\n[\na-zA-Z0-9 \[\]-_<>@]*",
3232
_new_key.out,
3333
)
3434
return _m.group(1) if _m else None
@@ -42,8 +42,8 @@ def tmp_commitizen_project_with_gpg(tmp_commitizen_project):
4242
# create a temporary GPGHOME to store a temporary keyring.
4343
# Home path must be less than 104 characters
4444
gpg_home = tempfile.TemporaryDirectory(suffix="_cz")
45-
# os.environ["GNUPGHOME"] = gpg_home.name # tempdir = temp keyring
46-
# os.environ["HOMEDIR"] = gpg_home.name
45+
if os.name != "nt":
46+
os.environ["GNUPGHOME"] = gpg_home.name # tempdir = temp keyring
4747

4848
# create a key (a keyring will be generated within GPUPGHOME)
4949
c = cmd.run(

0 commit comments

Comments
 (0)