Skip to content

Commit

Permalink
'added TravisCI config'
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderVi committed Jun 28, 2018
1 parent 74c80ab commit fc20ffe
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 12 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
@@ -0,0 +1,24 @@
sudo: false
language: python
python:
- '3.4'
env:
- TEST_SUITE='coverage run --source=pyega3 setup.py test'
install:
- pip install -r requirements.txt
- pip install python-coveralls
script:
- echo $TEST_SUITE
- echo $TEST_SUITE > test.sh
- bash test.sh
after_success:
- coverage report
- coveralls
- python setup.py sdist
deploy:
provider: pypi
user: ega-bot
password:
secure: dqxgzltDq8QxRtYeUvd7sZD0v8yG+fKs4Vomg2hwb/8uaPL6wgiYkeJLmsW4IoYMXzz6T1symJaUjj/kcHNTnr5Vw5FuWFr1KRNijmT1o6ZZ2czY8v/chJarvvl3o7alOI2xMsGPvHs2VLj3CV3NnrhuvV77dScKkiAQ+D6xZczkxxwlOGwyFYsIhmixXYJfSUrGt/gy/brd7L5+9d8qQa4l4pJ1ALdwp9EAT/L7pdQGChfk8+rQZKzsVjc6q+bqaSISA6VGiRdtyniua5KPe0FExUm2HFt4vast+3Kn3AfUginLjKO1rDtYSqNE5P5lKSiJJTWEezZnQv5i42O/d3BaiaFQk0YLqsKIue7ZVUsSuRmiMDHCsL6Gwi52d4IEs3rVmmTCHXkylwv6XWyGDAixF6q8UgK2i9D/+q3Rurhf8balvkYXhTAOnhXNryPiUQedaEKqN2TYj00rGzpNic1MLwDR5vFOGqT4PwFnwKMnKuGoTdUMmSZrryx9jqwyjOeSKzckQEFz2XBGjbJ0pA2Bj58nMkdMDgtbS6SaDQT0v2vzXKLPWLlGJP8BPBeFnD3VBo3Vx74jgxbd9l/1m9tWZIGJmPm8PnAoT+6Jc+cm2Hj0GelAvqEqM3IvUhtsPxdUTVe8byVEqUIRa5k5yOeym60MWkem4RmEQEkrrq0=
on:
tags: true
2 changes: 1 addition & 1 deletion pyega3/pyega3.py
Expand Up @@ -14,7 +14,7 @@
import time

debug = False
version = "3.0.15"
version = "3.0.16"

def load_credentials(filepath):
"""Load credentials for EMBL/EBI EGA from specified file"""
Expand Down
8 changes: 6 additions & 2 deletions requirements.txt
@@ -1,2 +1,6 @@
requests==2.9.1
tqdm==4.19.5
coverage==4.5.1
psutil==5.4.5
requests==2.18.4
responses==0.9.0
tqdm==4.19.6
urllib3==1.22
14 changes: 11 additions & 3 deletions setup.py
Expand Up @@ -8,14 +8,22 @@
description="EGA python client",
long_description=long_description,
packages=["pyega3"],
version = "3.0.15",
version = "3.0.16",
author="EGA team",
author_email="ega-helpdesk@ebi.ac.uk",
install_requires=["requests", "tqdm"],
keywords=["EGA", "archive"],
license="Apache License, Version 2.0",
url="https://github.com/EGA-archive/ega-download-client",
classifiers=[
"Development Status :: 3 - Alpha",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.4"
],
entry_points={
'console_scripts': [
'pyega3 = pyega3.pyega3:main',
"console_scripts": [
"pyega3 = pyega3.pyega3:main",
]
}
)
Empty file added test/__init__.py
Empty file.
14 changes: 8 additions & 6 deletions test_pyega3.py → test/test_pyega3.py
Expand Up @@ -225,7 +225,7 @@ def test_download_file_slice(self):
good_token = rand_str()

mem = virtual_memory().available
file_length = random.randint(1, mem//8)
file_length = random.randint(1, mem//512)
slice_start = random.randint(0,file_length)
slice_length = random.randint(0,file_length-slice_start)
file_name = rand_str()
Expand Down Expand Up @@ -284,9 +284,9 @@ def mock_write(buf):
def test_merge_bin_files_on_disk(self, mocked_remove):
mem = virtual_memory().available
files_to_merge = {
'f1.bin' : os.urandom(random.randint(1, mem//8)),
'f2.bin' : os.urandom(random.randint(1, mem//8)),
'f3.bin' : os.urandom(random.randint(1, mem//8)),
'f1.bin' : os.urandom(random.randint(1, mem//512)),
'f2.bin' : os.urandom(random.randint(1, mem//512)),
'f3.bin' : os.urandom(random.randint(1, mem//512)),
}
target_file_name = "merged.file"

Expand Down Expand Up @@ -348,7 +348,7 @@ def test_download_file(self,mocked_remove):
good_token = rand_str()

mem = virtual_memory().available
file_sz = random.randint(1, mem//8)
file_sz = random.randint(1, mem//512)
file_name = "resulting.file"
file_contents = os.urandom(file_sz)
file_md5 = hashlib.md5(file_contents).hexdigest()
Expand Down Expand Up @@ -403,7 +403,9 @@ def os_stat_mock(fn):
pyega3.download_file(
good_token, file_id, file_name+".cip", file_sz+16, wrong_md5, 1, None, output_file=None )

mocked_remove.assert_has_calls( [mock.call(os.path.join( os.getcwd(), file_id, os.path.basename(f) )) for f in mocked_files.keys()] )
mocked_remove.assert_has_calls(
[mock.call(os.path.join( os.getcwd(), file_id, os.path.basename(f) )) for f in mocked_files.keys()],
any_order=True )

with self.assertRaises(ValueError):
pyega3.download_file_retry( "", "", "", 0, 0, 1, "key", output_file=None )
Expand Down

0 comments on commit fc20ffe

Please sign in to comment.