Skip to content

Commit

Permalink
more makefile work
Browse files Browse the repository at this point in the history
  • Loading branch information
kalefranz committed Feb 4, 2017
1 parent 92396a0 commit 8fd61aa
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 26 deletions.
51 changes: 36 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
PYTHON ?= $(shell which python)
BIN := $(shell dirname $(PYTHON))
TEST_PLATFORM := $(shell python -c "import sys; print('win' if 'win' in sys.platform else 'unix')")
PYTHON_MAJOR_VERSION := $(shell $(PYTHON) -c "import sys; print(sys.version_info[0])")
PYTEST := PYTHON_MAJOR_VERSION=$(PYTHON_MAJOR_VERSION) TEST_PLATFORM=$(TEST_PLATFORM) $(BIN)/py.test
PYTEST_EXE := $(shell which py.test)
PYTEST_PYTHON := $(shell which py.test | xargs head -1 | sed 's/^\#!//')
PYTHON_MAJOR_VERSION := $(shell $(PYTEST_PYTHON) -c "import sys; print(sys.version_info[0])")
TEST_PLATFORM := $(shell $(PYTEST_PYTHON) -c "import sys; print('win' if sys.platform.startswith('win') else 'unix')")
PYTHONHASHSEED := $(shell python -c "import random as r; print(r.randint(0,4294967296))")

PYTEST_VARS := PYTHONHASHSEED=$(PYTHONHASHSEED) PYTHON_MAJOR_VERSION=$(PYTHON_MAJOR_VERSION) TEST_PLATFORM=$(TEST_PLATFORM)
PYTEST := $(PYTEST_VARS) $(PYTEST_EXE)

ADD_COV := --cov-report xml --cov-report term-missing --cov-append --cov conda


clean:
find . -name \*.py[cod] -delete
find . -name __pycache__ -delete
rm -rf *.egg-info* .cache build
rm -f .coverage .coverage.* junit.xml tmpfile.rc conda/.version tempfile.rc coverage.xml
rm -rf auxlib bin conda/progressbar
rm -rf conda-forge\:\: file\: https\: local\:\: r\:\: aprefix
@find . -name \*.py[cod] -delete
@find . -name __pycache__ -delete
@rm -rf *.egg-info* .cache build
@rm -f .coverage .coverage.* junit.xml tmpfile.rc conda/.version tempfile.rc coverage.xml
@rm -rf auxlib bin conda/progressbar
@rm -rf conda-forge\:\: file\: https\: local\:\: r\:\: aprefix


clean-all: clean
Expand Down Expand Up @@ -50,10 +56,25 @@ toolz:
rm -rf conda/_vendor/toolz/curried conda/_vendor/toolz/sandbox conda/_vendor/toolz/tests


pytest-version:
$(PYTEST) --version


smoketest:
py.test tests/test_create.py::test_create_install_update_remove
$(PYTEST) tests/test_create.py -k test_create_install_update_remove


unit: clean
time $(PYTEST) $(ADD_COV) -m "not integration and not installed"


integration: clean pytest-version
time $(PYTEST) $(ADD_COV) -m "not installed"


test-installed:
time $(PYTEST) $(ADD_COV) -m "installed" --shell=bash --shell=zsh

unit:
time $(PYTEST) -m "not integration"

.PHONY : clean clean-all anaconda-submit anaconda-submit-upload auxlib boltons toolz smoketest
.PHONY : clean clean-all anaconda-submit anaconda-submit-upload auxlib boltons toolz \
pytest-version smoketest unit integration test-installed
12 changes: 6 additions & 6 deletions conda/common/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# equivalent commands
# #############################

if PY3:
if PY3: # pragma: py2 no cover
string_types = str,
integer_types = int,
class_types = type,
Expand All @@ -30,7 +30,7 @@
input = input
range = range

elif PY2:
elif PY2: # pragma: py3 no cover
from types import ClassType
string_types = basestring,
integer_types = (int, long)
Expand All @@ -45,10 +45,10 @@
# equivalent imports
# #############################

if PY3:
if PY3: # pragma: py2 no cover
from io import StringIO
from itertools import zip_longest
elif PY2:
elif PY2: # pragma: py3 no cover
from cStringIO import StringIO
from itertools import izip as zip, izip_longest as zip_longest

Expand All @@ -61,7 +61,7 @@
# equivalent functions
# #############################

if PY3:
if PY3: # pragma: py2 no cover
def iterkeys(d, **kw):
return iter(d.keys(**kw))

Expand Down Expand Up @@ -89,7 +89,7 @@ def lchmod(path, mode):
def isiterable(obj):
return not isinstance(obj, string_types) and isinstance(obj, Iterable)

elif PY2:
elif PY2: # pragma: py3 no cover
def iterkeys(d, **kw):
return d.iterkeys(**kw)

Expand Down
4 changes: 2 additions & 2 deletions conda/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@


if PY3:
import configparser # NOQA
import configparser # NOQA # pragma: py2 no cover
else:
import ConfigParser as configparser # NOQA
import ConfigParser as configparser # NOQA # pragma: py3 no cover
configparser = configparser


Expand Down
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[tool:pytest]
minversion = 3.0
testpaths = tests conda
testpaths = conda tests
norecursedirs = .* *.egg* build dist conda/_vendor/* conda_env/*
addopts =
--ignore setup.py
--ignore conda/__main__.py
--cov conda
--tb native
--strict
--durations 8
Expand Down Expand Up @@ -49,7 +48,7 @@ omit =
exclude_lines =
pragma: no cover
pragma: py$PYTHON_MAJOR_VERSION no cover
pragma: py$PYTHON_MAJOR_VERSION no cover
pragma: $TEST_PLATFORM no cover
raise AssertionError
raise NotImplementedError
if __name__ == .__main__.:
Expand Down

0 comments on commit 8fd61aa

Please sign in to comment.