Skip to content

Commit

Permalink
adding the parts_directory concept, to both buildout and uranium.
Browse files Browse the repository at this point in the history
  • Loading branch information
toumorokoshi committed Feb 4, 2015
1 parent bb54a81 commit a3d98bd
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion uranium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _clean_package_resources(_pkg_resources, old_prefix):
# existing sys.path. These variables are set on
# initialization, so we have to reset them
# when activating a sandbox.
pkg_resources.working_set.entries = sys.path
_pkg_resources.working_set.entries = sys.path

LOGGING_NAMES = [__name__]

Expand Down
4 changes: 3 additions & 1 deletion uranium/buildout_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .compat import DictMixin
import zc.buildout
import logging
import os

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -61,5 +62,6 @@ def __len__(self):
def _buildout(self):
""" return a buildout """
return {
'directory': self._uranium.root
'directory': self._uranium.root,
'parts-directory': self._uranium.parts_directory
}
9 changes: 9 additions & 0 deletions uranium/tests/test_buildout_adapter/test_buildout_object.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import shutil
import tempfile
from uranium.uranium import Uranium
Expand Down Expand Up @@ -25,3 +26,11 @@ def test_buildout_section_directory(self):
the uranium root.
"""
eq_(self.buildout['buildout']['directory'], self.temp_dir)

def test_buildout_parts_directory(self):
"""
buildout['buildout']['parts-directory'] should return
the parts directory.
"""
eq_(self.buildout['buildout']['parts-directory'],
os.path.join(self.temp_dir, 'parts'))
9 changes: 9 additions & 0 deletions uranium/tests/test_uranium.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import shutil
import tempfile
from uranium.config import Config
from uranium.uranium import Uranium
from nose.tools import eq_


class TestUranium(object):
Expand Down Expand Up @@ -29,3 +31,10 @@ def tearDown(self):
def test_run_part(self):
self.uranium.run_part('platform-versions')
self.config.versions['nose'] == '1.1.0'

def test_root_property(self):
eq_(self.uranium.root, self.root)

def test_parts_directory_property(self):
eq_(self.uranium.parts_directory,
os.path.join(self.root, 'parts'))
6 changes: 6 additions & 0 deletions uranium/uranium.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

LOGGER = logging.getLogger(__name__)

PARTS_DIRECTORY = "parts"


class UraniumException(Exception):
pass
Expand Down Expand Up @@ -45,6 +47,10 @@ def config(self):
def root(self):
return self._root

@property
def parts_directory(self):
return os.path.join(self.root, PARTS_DIRECTORY)

def run(self):
[LOGGER.info(l) for l in START_URANIUM]

Expand Down
2 changes: 1 addition & 1 deletion uranium/virtualenv_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def install_virtualenv(install_dir):
return

create_environment(install_dir, no_setuptools=False,
no_pip=False, site_packages=False,
no_pip=True, site_packages=False,
symlink=False)


Expand Down

0 comments on commit a3d98bd

Please sign in to comment.