Example #1
0
 def test1(self):
     with interim_environ(ocrodjvu='42'):
         child = ipc.Subprocess(
             ['sh', '-c', 'printf $ocrodjvu'],
             stdout=ipc.PIPE, stderr=ipc.PIPE,
         )
         stdout, stderr = child.communicate()
         assert_equal(stdout, '42')
         assert_equal(stderr, '')
Example #2
0
 def test1(self):
     with interim_environ(ocrodjvu='42'):
         child = ipc.Subprocess(
             ['sh', '-c', 'printf $ocrodjvu'],
             stdout=ipc.PIPE,
             stderr=ipc.PIPE,
         )
         stdout, stderr = child.communicate()
         assert_equal(stdout, '42')
         assert_equal(stderr, '')
Example #3
0
 def test_path(self):
     path = os.getenv('PATH').split(':')
     with temporary.directory() as tmpdir:
         command_name = temporary.name(dir=tmpdir)
         command_path = os.path.join(tmpdir, command_name)
         with open(command_path, 'wt') as file:
             print('#!/bin/sh', file=file)
             print('printf 42', file=file)
         os.chmod(command_path, stat.S_IRWXU)
         path[:0] = [tmpdir]
         path = ':'.join(path)
         with interim_environ(PATH=path):
             child = ipc.Subprocess([command_name],
                 stdout=ipc.PIPE, stderr=ipc.PIPE,
             )
             stdout, stderr = child.communicate()
             assert_equal(stdout, '42')
             assert_equal(stderr, '')
Example #4
0
 def test_path(self):
     path = os.getenv('PATH').split(':')
     with temporary.directory() as tmpdir:
         command_name = temporary.name(dir=tmpdir)
         command_path = os.path.join(tmpdir, command_name)
         with open(command_path, 'wt') as file:
             print('#!/bin/sh', file=file)
             print('printf 42', file=file)
         os.chmod(command_path, stat.S_IRWXU)
         path[:0] = [tmpdir]
         path = ':'.join(path)
         with interim_environ(PATH=path):
             child = ipc.Subprocess(
                 [command_name],
                 stdout=ipc.PIPE,
                 stderr=ipc.PIPE,
             )
             stdout, stderr = child.communicate()
             assert_equal(stdout, '42')
             assert_equal(stderr, '')
Example #5
0
 def test_locale_lang(self):
     with interim_environ(LC_ALL=None, LC_CTYPE=None, LANG='en_US.UTF-8'):
         self._test_locale()
Example #6
0
 def test_locale_lc_ctype(self):
     with interim_environ(LC_ALL=None, LC_CTYPE='en_US.UTF-8'):
         self._test_locale()
Example #7
0
 def test_locale_lc_all(self):
     with interim_environ(LC_ALL='en_US.UTF-8'):
         self._test_locale()
Example #8
0
 def test_locale_lang(self):
     with interim_environ(LC_ALL=None, LC_CTYPE=None, LANG='en_US.UTF-8'):
         self._test_locale()
Example #9
0
 def test_locale_lc_ctype(self):
     with interim_environ(LC_ALL=None, LC_CTYPE='en_US.UTF-8'):
         self._test_locale()
Example #10
0
 def test_locale_lc_all(self):
     with interim_environ(LC_ALL='en_US.UTF-8'):
         self._test_locale()