~therp-nl/anybox.recipe.openerp/jbaudoux-relative_paths_resolve_conflict

« back to all changes in this revision

Viewing changes to anybox/recipe/openerp/tests/test_utils.py

[MRG] Update with target branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import unittest
 
2
import tempfile
 
3
import shutil
 
4
import os
 
5
 
 
6
from ..utils import working_directory_keeper
 
7
 
 
8
 
 
9
class WorkingDirectoryTestCase(unittest.TestCase):
 
10
 
 
11
    def setUp(self):
 
12
        self.dirpath = tempfile.mkdtemp()
 
13
 
 
14
    def tearDown(self):
 
15
        shutil.rmtree(self.dirpath)
 
16
 
 
17
    def test_ctx_manager(self):
 
18
        # warning: if this fails, then many other tests can be
 
19
        # affected, because many don't like being in /
 
20
        current = os.getcwd()
 
21
        with working_directory_keeper:
 
22
            os.chdir(self.dirpath)
 
23
            self.assertNotEqual(os.getcwd(), current)
 
24
 
 
25
        self.assertEqual(os.getcwd(), current)