From 3d924e9239b318ca6ab4b36b7c3438fcf8c362f1 Mon Sep 17 00:00:00 2001 From: Yoram Shamir Date: Mon, 19 Jun 2017 10:43:59 +0300 Subject: [PATCH] create zip offline_requirements with propper name --- .gitignore | 5 +++++ requirements_dev.txt | 3 ++- shellfoundry/commands/dist_command.py | 15 +++++++++++---- shellfoundry/version.py | 2 +- tests/test_commands/test_dist_command.py | 6 +++++- tox.ini | 7 +++---- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index dc893f9..b4d06f4 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,8 @@ docs/_build/ # PyBuilder target/ .idea/ + +# pydev +.project +.pydevproject +.settings \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt index 444ef67..dab94f2 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -7,4 +7,5 @@ coverage==4.0 Sphinx==1.3.1 cryptography==1.0.1 PyYAML==3.11 - +httpretty +freezegun \ No newline at end of file diff --git a/shellfoundry/commands/dist_command.py b/shellfoundry/commands/dist_command.py index dd31c0e..12e5afd 100644 --- a/shellfoundry/commands/dist_command.py +++ b/shellfoundry/commands/dist_command.py @@ -1,16 +1,23 @@ + import os +from shellfoundry.utilities.archive_creator import ArchiveCreator from shellfoundry.utilities.python_dependencies_packager import PythonDependenciesPackager +from shellfoundry.utilities.shell_config_reader import ShellConfigReader class DistCommandExecutor(object): def __init__(self, dependencies_packager=None): self.dependencies_packager = dependencies_packager or PythonDependenciesPackager() + self.config_reader = ShellConfigReader() def dist(self): - current_path = os.getcwd() - requirements_path = os.path.join(current_path, 'src', 'requirements.txt') - dest_path = os.path.join(current_path, 'dist', 'offline_requirements') + current_path = os.getcwd() + dist_path = os.path.join(current_path, 'dist') + offline_requirements_path = os.path.join(dist_path, 'offline_requirements') + requirements_file_path = os.path.join(current_path, 'src', 'requirements.txt') + zip_file_path = os.path.join(dist_path, self.config_reader.read().name + '_offline_requirements.zip') - self.dependencies_packager.save_offline_dependencies(requirements_path, dest_path) + self.dependencies_packager.save_offline_dependencies(requirements_file_path, offline_requirements_path) + ArchiveCreator.make_archive(zip_file_path, 'zip', offline_requirements_path) diff --git a/shellfoundry/version.py b/shellfoundry/version.py index 407b8a2..14e974f 100644 --- a/shellfoundry/version.py +++ b/shellfoundry/version.py @@ -1 +1 @@ -__version__ = '0.2.7' +__version__ = '0.2.8' diff --git a/tests/test_commands/test_dist_command.py b/tests/test_commands/test_dist_command.py index 7e1f6d0..6b371b9 100644 --- a/tests/test_commands/test_dist_command.py +++ b/tests/test_commands/test_dist_command.py @@ -1,8 +1,9 @@ + +import os from mock import Mock from pyfakefs import fake_filesystem_unittest from shellfoundry.commands.dist_command import DistCommandExecutor -from tests.asserts import * class TestDistCommandExecutor(fake_filesystem_unittest.TestCase): @@ -35,3 +36,6 @@ def test_dependencies_downloaded(self): self.assertEqual(args[0].split(os.path.sep)[-2], 'src') self.assertEqual(args[1].split(os.path.sep)[-1], 'offline_requirements') self.assertEqual(args[1].split(os.path.sep)[-2], 'dist') + + ls = os.listdir(os.path.dirname(args[1])) + self.assertEqual(ls[0], 'nut_shell_offline_requirements.zip') diff --git a/tox.ini b/tox.ini index e0c5d99..a1a478a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,9 @@ [tox] -envlist = py26, py27, py33, py34, py35 +envlist = py27, py35 [testenv] -setenv = - PYTHONPATH = {toxinidir}:{toxinidir}/shellfoundry -commands = python setup.py test +deps = -rrequirements.txt +commands = py.test ; If you want to make tox run the tests with the same versions, create a ; requirements.txt with the pinned versions and uncomment the following lines: