Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 31 additions and 0 deletions.
  1. +2 −0 src/mr/developer/develop.py
  2. +29 −0 src/mr/developer/tests/test_develop.py
View
2 src/mr/developer/develop.py
@@ -16,6 +16,8 @@
def find_base():
+ if 'MRDEVELOPER_BASE' in os.environ:
+ return os.environ['MRDEVELOPER_BASE']
path = os.getcwd()
while path:
if os.path.exists(os.path.join(path, '.mr.developer.cfg')):
View
29 src/mr/developer/tests/test_develop.py
@@ -1,4 +1,7 @@
from unittest import TestCase
+import os
+import tempfile
+import shutil
class MockDevelop(object):
@@ -72,3 +75,29 @@ def testArgsMatchingMultiple2Auto(self):
pkgs = Command(self.develop).get_packages(['ha', 'ba'],
auto_checkout=True)
self.assertEquals(pkgs, set(['ham']))
+
+
+class TestFindBase(TestCase):
+ def setUp(self):
+ self.location = tempfile.mkdtemp()
+
+ def tearDown(self):
+ shutil.rmtree(self.location)
+
+ def testEnvironmentVar(self):
+ from mr.developer.develop import find_base
+ subdir = os.path.join(self.location, 'subdir')
+ os.mkdir(subdir)
+ devdir = os.path.join(self.location, 'devdir')
+ os.mkdir(devdir)
+ open(os.path.join(devdir, '.mr.developer.cfg'), 'w').close()
+ orig_dir = os.getcwd()
+ try:
+ os.chdir(subdir)
+ self.assertRaises(IOError, find_base)
+ os.environ['MRDEVELOPER_BASE'] = devdir
+ self.assertEqual(find_base(), devdir)
+ finally:
+ os.chdir(orig_dir)
+ if 'MRDEVELOPER_BASE' in os.environ:
+ del os.environ['MRDEVELOPER_BASE']

No commit comments for this range

Something went wrong with that request. Please try again.