Skip to content

Commit

Permalink
Merge branch 'cross-platform-testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed Jan 12, 2023
2 parents b66ca5c + e4dad67 commit 128a2c1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,37 @@ permissions:

jobs:
test_devpy:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.7"]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: ${{ matrix.python_version }}
- name: Install
run: |
pip install -e .
pip install pytest meson-python ninja
- name: Library tests
env:
PYTHONPATH: "."
run: |
PYTHONPATH=. pytest --pyargs devpy
- name: Functional tests
pytest --pyargs devpy
- name: Functional tests (linux)
if: matrix.os == 'ubuntu-latest'
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
env:
TERM: xterm-256color
run: |
cd example_pkg
./dev.py build
./dev.py test
- name: Functional tests (other)
if: matrix.os != 'ubuntu-latest'
run: |
cd example_pkg
./dev.py build
./dev.py test
13 changes: 4 additions & 9 deletions devpy/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import collections
import os
import sys
import importlib
Expand All @@ -16,22 +17,16 @@
click.Context.formatter_class = ColorHelpFormatter


class DotDict(dict):
class DotDict(collections.UserDict):
def __getitem__(self, key):
subitem = self
subitem = self.data
for subkey in key.split("."):
try:
subitem = dict.__getitem__(subitem, subkey)
subitem = subitem[subkey]
except KeyError:
raise KeyError(f"`{key}` not found in configuration") from None
return subitem

def get(self, key, default=None, /):
try:
return self.__getitem__(key)
except KeyError:
return default


if __name__ == "__main__":
if not os.path.exists("pyproject.toml"):
Expand Down
3 changes: 2 additions & 1 deletion devpy/cmds/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def run(cmd, cwd=None, replace=False, sys_exit=True, output=True, *args, **kwarg
if cwd:
click.secho(f"$ cd {cwd}", bold=True, fg="bright_blue")
os.chdir(cwd)
click.secho(f"$ {shlex.join(cmd)}", bold=True, fg="bright_blue")
cmdstr = ' '.join(shlex.quote(arg) for arg in cmd)
click.secho(f"$ {cmdstr}", bold=True, fg="bright_blue")

if output is False:
output_kwargs = {"stdout": subprocess.PIPE, "stderr": subprocess.STDOUT}
Expand Down

0 comments on commit 128a2c1

Please sign in to comment.