Commit d137b850 authored by David Trudgian's avatar David Trudgian
Browse files

Coveralls/test tweaks

parent 21e88886
...@@ -4,8 +4,6 @@ language: python ...@@ -4,8 +4,6 @@ language: python
python: python:
- "2.7" - "2.7"
- "3.4" - "3.4"
- "3.5"
- "3.6"
before_install: before_install:
- wget -O- http://neuro.debian.net/lists/trusty.us-nh.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list - wget -O- http://neuro.debian.net/lists/trusty.us-nh.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
- sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9 - sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
...@@ -14,5 +12,10 @@ before_install: ...@@ -14,5 +12,10 @@ before_install:
install: install:
- pip install --only-binary=numpy,scipy,scikit-learn,pandas numpy scipy scikit-learn pandas - pip install --only-binary=numpy,scipy,scikit-learn,pandas numpy scipy scikit-learn pandas
- pip install flake8 pytest pytest-cov pytest-flake8 - pip install flake8 pytest pytest-cov pytest-flake8
- pip install python-coveralls
- python setup.py install - python setup.py install
script: pytest --cov --flake8 clair_singularity/ script:
- pytest tests/ --cov clair_singularity --cov-report term-missing
after_success:
- coveralls
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<a href="https://codeclimate.com/github/dctrud/clair-singularity"><img src="https://codeclimate.com/github/dctrud/clair-singularity/badges/gpa.svg" /></a> <a href="https://codeclimate.com/github/dctrud/clair-singularity"><img src="https://codeclimate.com/github/dctrud/clair-singularity/badges/gpa.svg" /></a>
<a href="https://travis-ci.org/dctrud/clair-singularity"><img src="https://travis-ci.org/dctrud/clair-singularity.svg?branch=master"></a> <a href="https://travis-ci.org/dctrud/clair-singularity"><img src="https://travis-ci.org/dctrud/clair-singularity.svg?branch=master"></a>
[![Coverage Status](https://coveralls.io/repos/github/dctrud/clair-singularity/badge.svg?branch=master)](https://coveralls.io/github/dctrud/clair-singularity?branch=master)
__Scan [Singularity](http://singularity.lbl.gov/) container images for security vulnerabilities __Scan [Singularity](http://singularity.lbl.gov/) container images for security vulnerabilities
using [CoreOS Clair](https://github.com/coreos/clai).__ using [CoreOS Clair](https://github.com/coreos/clai).__
......
import multiprocessing import multiprocessing
import os import os
import subprocess import subprocess
import sys
import time import time
import pytest import pytest
...@@ -22,7 +21,7 @@ def testimage(tmpdir): ...@@ -22,7 +21,7 @@ def testimage(tmpdir):
return os.path.join(tmpdir.strpath, 'vsoch-singularity-hello-world-master.img') return os.path.join(tmpdir.strpath, 'vsoch-singularity-hello-world-master.img')
def check_image(testimage): def test_check_image(testimage):
# Valid image return True # Valid image return True
assert check_image(testimage) assert check_image(testimage)
# Sys exit for invalid image # Sys exit for invalid image
...@@ -64,4 +63,5 @@ def test_http_server(testimage, tmpdir): ...@@ -64,4 +63,5 @@ def test_http_server(testimage, tmpdir):
httpd.terminate() httpd.terminate()
assert r.status_code == requests.codes.ok assert r.status_code == requests.codes.ok
assert sha256(tmpfile) == '4dba283867ee8bd6178cb6f58778bf8b59e14833468fab58c4e52d9eeae7759f' assert sha256(tmpfile) == \
'4dba283867ee8bd6178cb6f58778bf8b59e14833468fab58c4e52d9eeae7759f'
import pytest
from clair_singularity.util import sha256 from clair_singularity.util import sha256
def test_sha256(): def test_sha256():
"""Check we can get a sha256 on something that won't change often""" """Check we can get a sha256 on something that won't change often"""
assert sha256('.gitignore') == 'da04d844bb8a1fd051cfc7cb8bba1437f3f237f48d2974d72f749ad7fbfd1d96' assert sha256('.gitignore') == \
\ No newline at end of file 'da04d844bb8a1fd051cfc7cb8bba1437f3f237f48d2974d72f749ad7fbfd1d96'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment