core/ci: fix windows-specific issues

- use portable separators
- paths should be prepended with r' (so backwards slash isn't treated as escaping)
- sqlite connections should be closed (otherwise windows fails to remove the underlying db file)
- workaround for emojis via PYTHONUTF8=1 test for now
- make ZipPath portable
- properly use tox python environment everywhere

  this was causing issues on Windows
  e.g.
      WARNING: test command found but not installed in testenv
        cmd: C:\hostedtoolcache\windows\Python\3.9.12\x64\python3.EXE
This commit is contained in:
Dima Gerasimov 2022-05-02 18:26:22 +01:00 committed by karlicoss
parent 637982a5ba
commit 64a4782f0e
11 changed files with 67 additions and 37 deletions

View file

@ -16,6 +16,7 @@ NOT_HPI_MODULE_VAR = '__NOT_HPI_MODULE__'
###
import ast
import os
from typing import Optional, Sequence, List, NamedTuple, Iterable, cast, Any
from pathlib import Path
import re
@ -151,7 +152,7 @@ def _modules_under_root(my_root: Path) -> Iterable[HPIModule]:
mp = f.relative_to(my_root.parent)
if mp.name == '__init__.py':
mp = mp.parent
m = str(mp.with_suffix('')).replace('/', '.')
m = str(mp.with_suffix('')).replace(os.sep, '.')
if ignored(m):
continue
a: ast.Module = ast.parse(f.read_text())
@ -192,7 +193,7 @@ def test() -> None:
def test_demo() -> None:
demo = module_by_name('my.demo')
assert demo.doc is not None
assert str(demo.file) == 'my/demo.py'
assert demo.file == Path('my', 'demo.py')
assert demo.requires is None