-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a97d4e6
commit 703c492
Showing
5 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
def generate_activate_this(uranium): | ||
""" | ||
generate a text block which should be injected into an activate_this script. | ||
""" | ||
return ( | ||
_generate_environment_variables(uranium) | ||
) | ||
|
||
|
||
ENV_TEMPLATE = """ | ||
import os | ||
""".strip() | ||
|
||
|
||
def _generate_environment_variables(uranium): | ||
content = ENV_TEMPLATE | ||
for name, value in uranium.environment.items(): | ||
content += "\nos.environ['{name}'] = '{value}'".format( | ||
name=name, value=value | ||
) | ||
|
||
return content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
tests for the warmup script | ||
""" | ||
import os | ||
from uranium.tests.utils import FullUraniumBaseTest | ||
from nose.tools import ok_ | ||
|
||
BASE = os.path.dirname(__file__) | ||
URANIUM_ROOT_PATH = os.path.join(BASE, os.pardir, os.pardir, os.pardir) | ||
|
||
|
||
class TestEggResolution(FullUraniumBaseTest): | ||
|
||
config = { | ||
'phases': { | ||
'after-eggs': ['environment'] | ||
}, | ||
'parts': { | ||
'environment': { | ||
'_plugin': 'uranium.plugin.example', | ||
'environment': { | ||
'LD_LIBRARY_PATH': '/usr/lib' | ||
} | ||
} | ||
} | ||
} | ||
|
||
def test_environment_variable_is_set(self): | ||
activate_this = os.path.join(self.root, 'bin', 'activate_this.py') | ||
with open(activate_this) as fh: | ||
content = fh.read() | ||
|
||
ok_("os.environ['LD_LIBRARY_PATH'] = '/usr/lib'" in content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters