Ejemplo n.º 1
0
    def _run_mach(self, args, context_handler=None):
        mach_dir = os.path.dirname(mach.__file__)
        providers = [
            'commands.py',
            os.path.join(mach_dir, 'commands', 'commandinfo.py'),
        ]

        return TestBase._run_mach(self,
                                  args,
                                  providers,
                                  context_handler=context_handler)
Ejemplo n.º 2
0
    def _run_mach(self, args):
        mach_dir = os.path.dirname(mach.__file__)
        providers = [
            'commands.py',
            os.path.join(mach_dir, 'commands', 'commandinfo.py'),
        ]

        def context_handler(key):
            if key == 'topdir':
                return topsrcdir

        return TestBase._run_mach(self, args, providers,
                                  context_handler=context_handler)
Ejemplo n.º 3
0
def test_set_isatty_environ(monkeypatch):
    # Make sure the 'MACH_STDOUT_ISATTY' variable gets set.
    monkeypatch.delenv('MACH_STDOUT_ISATTY', raising=False)
    monkeypatch.setattr(os, 'isatty', lambda fd: True)

    m = TestBase.get_mach()
    orig_run = m._run
    env_is_set = []

    def wrap_run(*args, **kwargs):
        env_is_set.append('MACH_STDOUT_ISATTY' in os.environ)
        return orig_run(*args, **kwargs)

    monkeypatch.setattr(m, '_run', wrap_run)

    ret = m.run([])
    assert ret == 0
    assert env_is_set[0]
Ejemplo n.º 4
0
def run_mach():

    tester = TestBase()

    def inner(args):
        mach_dir = os.path.dirname(mach.__file__)
        providers = [
            'commands.py',
            os.path.join(mach_dir, 'commands', 'commandinfo.py'),
        ]

        def context_handler(key):
            if key == 'topdir':
                return topsrcdir

        return tester._run_mach(args, providers, context_handler=context_handler)

    return inner
Ejemplo n.º 5
0
 def _run_mach(self, args, context_handler=_populate_bare_context):
     return TestBase._run_mach(self,
                               args,
                               'conditions.py',
                               context_handler=context_handler)
Ejemplo n.º 6
0
 def _run_mach(self, args):
     return TestBase._run_mach(self,
                               args,
                               'throw.py',
                               context_handler=_populate_context)
Ejemplo n.º 7
0
 def _run_mach(self, args):
     return TestBase._run_mach(self, args, 'throw.py')
Ejemplo n.º 8
0
 def _run_mach(self):
     return TestBase._run_mach(self, ['help'], entry_point='mach.providers')
Ejemplo n.º 9
0
 def _run_mach(self, args, context_handler=None):
     return TestBase._run_mach(self, args, 'conditions.py',
                               context_handler=context_handler)
Ejemplo n.º 10
0
 def _run_mach(self, args, context_handler=None):
     return TestBase._run_mach(self, args, 'conditions.py',
                               context_handler=context_handler)
Ejemplo n.º 11
0
 def _run_mach(self):
     return TestBase._run_mach(self, ['help'], entry_point='mach.providers')
Ejemplo n.º 12
0
 def _run_mach(self, args):
     return TestBase._run_mach(self, args, 'throw.py')