Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
max-parallel: 4
matrix:
# Up to date compatibility matrix
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
python-version: [3.7, 3.8, 3.9, "3.10"]
os: [ubuntu-latest, windows-latest]

steps:
Expand All @@ -20,8 +20,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
env:
DJANGO_VERSION: ${{ matrix.django-version }}
run: |
python -m pip install --upgrade pip
make testenv
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ testenv:
pip install -e .

test:
nosetests --with-coverage --cover-erase --cover-branches --cover-package=clinto clinto/tests/*
pytest --cov=clinto --cov-config=.coveragerc clinto/tests/*
coverage report --omit='clinto/tests*'
coverage xml --omit='clinto/tests*'

Expand Down
20 changes: 20 additions & 0 deletions clinto/parsers/argparse_.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,27 @@ def extract_parser(self):
try:
ast_source = source_parser.parse_source_file(self.script_path)
python_code = source_parser.convert_to_python(list(ast_source))
f.write(six.b("""
import builtins
from types import ModuleType

class DummyModule(ModuleType):
def __getattr__(self, key):
return None
__all__ = [] # support wildcard imports

def tryimport(name, globals={}, locals={}, fromlist=[], level=-1):
try:
return realimport(name, globals, locals, fromlist, level)
except (ImportError, ModuleNotFoundError):
return DummyModule(name)

realimport, builtins.__import__ = builtins.__import__, tryimport
"""))
f.write(six.b("\n".join(python_code)))
f.write(six.b("""
builtins.__import__ = realimport
"""))
f.seek(0)
module = imp.load_source("__main__", f.name)
except Exception:
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coveralls
nose
pytest
pytest-cov
5 changes: 0 additions & 5 deletions tox.ini

This file was deleted.