Ejemplo n.º 1
0
 def compile(self, verbose=False):
     if verbose:
         _stderr("Compiling", self.filename)
     with values({"p10s": {"file": self.filename}}):
         with _global_state(dir=self.base_dir,
                            extra_sys_paths=[self.pyterranetes_dir]):
             CONTEXTS.clear()
             globals = runpy.run_path(str(self.filename))
             for value in globals.values():
                 if isinstance(value, BaseContext):
                     self.contexts.append(value)
             self.contexts.extend(CONTEXTS)
     return self
Ejemplo n.º 2
0
def test_value_values_args3():
    with values({'a': 'top_A'}):
        with values(a='mid_A'):
            with values({}, {'a': 'bottom_A'}):
                assert value('a') == 'bottom_A'
Ejemplo n.º 3
0
def test_value_values_args2():
    with values({'a': 'top_A'}, {'b': 'top_B'}):
        with values(b='bottom_B'):
            assert value('b') == 'bottom_B'
Ejemplo n.º 4
0
def test_value_values_args1():
    with values({'a': 'top_first'}, {'a': 'top_second'}, a='top_third'):
        assert value('a') == 'top_third'
Ejemplo n.º 5
0
def test_value_inheritence3():
    with values(foo='top', bar='top'):
        with values(foo='bottom'):
            assert value('bar') == 'top'
            assert value('foo') == 'bottom'
Ejemplo n.º 6
0
def test_value_inheritence2():
    with values(foo='top', bar='top'):
        _set_foo()
        assert _inner() == 'inner'
        with values(foo='bottom'):
            assert _inner() == 'bottom'
Ejemplo n.º 7
0
def test_value_inheritence1():
    with values({'bar': 'top'}, foo='top'):
        with values(foo='bottom'):
            assert _inner() == 'bottom'