Merge branch 'master' into pubsync

This commit is contained in:
Eric Froemling 2020-03-26 20:01:29 -07:00
commit aa17af5632
5 changed files with 43 additions and 6 deletions

View File

@ -8,14 +8,37 @@ on:
- cron: '0 12 * * *'
jobs:
check:
# We run most of our testing on linux but it should apply to mac too;
# we can always add an explicit mac job if it seems worthwhile.
ci_unix:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
sudo apt-get -y install python3.7 python3.7-dev python3-pip python3-setuptools
tools/snippets install_pip_reqs
run: tools/snippets install_pip_reqs
- name: Run checks and tests
run: make -j2 check test
# Most of our toolset doesn't work on raw windows (outside of WSL).
# However, it's nice to at least run unit tests there since some behavior
# (filesystem, etc) can vary significantly.
ci_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Run tests
run: python tools/snippets pytest -v tests

View File

@ -308,6 +308,7 @@
<w>completecmd</w>
<w>compounddict</w>
<w>compoundlist</w>
<w>conditionalize</w>
<w>configerror</w>
<w>confighash</w>
<w>configkey</w>

View File

@ -29,6 +29,7 @@ from __future__ import annotations
import os
import json
import subprocess
import platform
from pathlib import Path
from typing import TYPE_CHECKING
@ -37,7 +38,7 @@ if TYPE_CHECKING:
from typing_extensions import Literal
# Python binary assumed by these tools.
PYTHON_BIN = 'python3.7'
PYTHON_BIN = 'python3.7' if platform.system() != 'Windows' else 'python'
MIT_LICENSE = """Copyright (c) 2011-2020 Eric Froemling

View File

@ -443,6 +443,7 @@ def compile_python_files() -> None:
def pytest() -> None:
"""Run pytest with project environment set up properly."""
import platform
from efrotools import get_config, PYTHON_BIN
# Grab our python paths for the project and stuff them in PYTHONPATH.
@ -450,7 +451,8 @@ def pytest() -> None:
if pypaths is None:
raise CleanError('python_paths not found in project config.')
os.environ['PYTHONPATH'] = ':'.join(pypaths)
separator = ';' if platform.system() == 'Windows' else ':'
os.environ['PYTHONPATH'] = separator.join(pypaths)
# Also tell Python interpreters not to write __pycache__ dirs everywhere
# which can screw up our builds.

View File

@ -26,6 +26,7 @@ from typing import TYPE_CHECKING
import tempfile
import os
import subprocess
import logging
if TYPE_CHECKING:
from typing import Any, Type, Dict, Optional, List, Union
@ -180,8 +181,17 @@ def static_type_equals(value: Any, statictype: Union[Type, str]) -> bool:
a match (for instance, if mypy outputs 'builtins.int*' it will match
the 'int' type passed in as statictype).
"""
import platform
from inspect import getframeinfo, stack
# NOTE: don't currently support windows here; just going to always
# pass so we don't have to conditionalize all our individual test
# locations.
if platform.system() == 'Windows':
logging.debug('static_type_equals not supported on windows;'
' will always pass...')
return True
# We don't actually use there here; we pull them as strings from the src.
del value