Explorar el Código

Merge pull request #1920 from dnephin/use_pytest

Use py.test as a test runner
Aanand Prasad hace 10 años
padre
commit
c63ae64ca6
Se han modificado 9 ficheros con 30 adiciones y 28 borrados
  1. 1 1
      Dockerfile
  2. 1 0
      requirements-build.txt
  3. 3 5
      requirements-dev.txt
  4. 0 1
      script/build-linux
  5. 6 3
      script/build-linux-inner
  6. 1 1
      script/build-osx
  7. 1 1
      script/ci
  8. 1 4
      setup.py
  9. 16 12
      tox.ini

+ 1 - 1
Dockerfile

@@ -91,7 +91,7 @@ RUN pip install -r requirements-dev.txt
 RUN pip install tox==2.1.1
 
 ADD . /code/
-RUN python setup.py install
+RUN pip install --no-deps -e /code
 
 RUN chown -R user /code/
 

+ 1 - 0
requirements-build.txt

@@ -0,0 +1 @@
+git+https://github.com/pyinstaller/pyinstaller.git@12e40471c77f588ea5be352f7219c873ddaae056#egg=pyinstaller

+ 3 - 5
requirements-dev.txt

@@ -1,6 +1,4 @@
 coverage==3.7.1
-flake8==2.3.0
-git+https://github.com/pyinstaller/pyinstaller.git@12e40471c77f588ea5be352f7219c873ddaae056#egg=pyinstaller
-mock >= 1.0.1
-nose==1.3.4
-pep8==1.6.1
+mock>=1.0.1
+pytest==2.7.2
+pytest-cov==2.1.0

+ 0 - 1
script/build-linux

@@ -6,7 +6,6 @@ TAG="docker-compose"
 docker build -t "$TAG" .
 docker run \
   --rm \
-  --user=user \
   --volume="$(pwd):/code" \
   --entrypoint="script/build-linux-inner" \
   "$TAG"

+ 6 - 3
script/build-linux-inner

@@ -2,9 +2,12 @@
 
 set -ex
 
+TARGET=dist/docker-compose-Linux-x86_64
+
 mkdir -p `pwd`/dist
 chmod 777 `pwd`/dist
 
-pyinstaller -F bin/docker-compose
-mv dist/docker-compose dist/docker-compose-Linux-x86_64
-dist/docker-compose-Linux-x86_64 version
+pip install -r requirements-build.txt
+su -c "pyinstaller -F bin/docker-compose" user
+mv dist/docker-compose $TARGET
+$TARGET version

+ 1 - 1
script/build-osx

@@ -6,7 +6,7 @@ PATH="/usr/local/bin:$PATH"
 rm -rf venv
 virtualenv -p /usr/local/bin/python venv
 venv/bin/pip install -r requirements.txt
-venv/bin/pip install -r requirements-dev.txt
+venv/bin/pip install -r requirements-build.txt
 venv/bin/pip install .
 venv/bin/pyinstaller -F bin/docker-compose
 mv dist/docker-compose dist/docker-compose-Darwin-x86_64

+ 1 - 1
script/ci

@@ -13,4 +13,4 @@ export DOCKER_DAEMON_ARGS="--storage-driver=overlay"
 . script/test-versions
 
 >&2 echo "Building Linux binary"
-su -c script/build-linux-inner user
+. script/build-linux-inner

+ 1 - 4
setup.py

@@ -41,13 +41,10 @@ install_requires = [
 
 
 tests_require = [
-    'nose',
-    'flake8',
+    'pytest',
 ]
 
 
-if sys.version_info < (2, 7):
-    tests_require.append('unittest2')
 if sys.version_info[:1] < (3,):
     tests_require.append('mock >= 1.0.1')
 

+ 16 - 12
tox.ini

@@ -8,10 +8,14 @@ passenv =
 setenv =
     HOME=/tmp
 deps =
-    -rrequirements.txt
+    -rrequirements-dev.txt
 commands =
-    nosetests -v --with-coverage --cover-branches --cover-package=compose --cover-erase --cover-html-dir=coverage-html --cover-html {posargs}
-    flake8 compose tests setup.py
+    py.test -v \
+        --cov=compose \
+        --cov-report html \
+        --cov-report term \
+        --cov-config=tox.ini \
+        {posargs}
 
 [testenv:pre-commit]
 skip_install = True
@@ -21,16 +25,16 @@ commands =
     pre-commit install
     pre-commit run --all-files
 
-[testenv:py27]
-deps =
-    {[testenv]deps}
-    -rrequirements-dev.txt
+# Coverage configuration
+[run]
+branch = True
 
-[testenv:py34]
-deps =
-    {[testenv]deps}
-    flake8
-    nose
+[report]
+show_missing = true
+
+[html]
+directory = coverage-html
+# end coverage configuration
 
 [flake8]
 # Allow really long lines for now