def test_parse_default(): with wrap() as wrapper: wrapper.nodes = {} wrapper.roots = [] wrapper.batch = dexy.batch.Batch(wrapper) wrapper.filemap = wrapper.map_files() ast = AbstractSyntaxTree(wrapper) parser = Yaml(wrapper, ast) parser.parse('.', YAML_WITH_DEFAULT_OFF) ast.walk() assert len(wrapper.nodes) == 0 with wrap() as wrapper: wrapper.nodes = {} wrapper.roots = [] wrapper.batch = dexy.batch.Batch(wrapper) wrapper.filemap = wrapper.map_files() ast = AbstractSyntaxTree(wrapper) wrapper.full = True parser = Yaml(wrapper, ast) parser.parse('.', YAML_WITH_DEFAULT_OFF) ast.walk() assert len(wrapper.nodes) == 1
def test_generic_data(): with wrap() as wrapper: CONTENTS = "contents go here" # Create a GenericData object data = dexy.data.GenericData("doc.txt", ".txt", "hash1", wrapper) # Assign some text contents data._data = CONTENTS assert data.has_data() assert not data.is_cached() assert not data.filesize() # Save data to disk data.save() assert data.has_data() assert data.is_cached() assert data.filesize() > 10 # Clear data from memory data._data = None assert data.has_data() # Load it again from disk data.load_data() assert data._data == CONTENTS # The convenience methods load from disk if needed. data._data = None assert data.as_text() == CONTENTS data._data = None assert data.as_sectioned()['1'] == CONTENTS
def test_generic_data(): with wrap() as wrapper: wrapper.to_walked() wrapper.to_checked() CONTENTS = "contents go here" # Create a GenericData object settings = { 'canonical-name' : 'doc.txt' } data = dexy.data.Generic("doc.txt", ".txt", "abc000", settings, wrapper) data.setup_storage() # Assign some text contents data._data = CONTENTS assert data.has_data() assert not data.is_cached(True) # Save data to disk data.save() assert data.has_data() assert data.is_cached(True) assert data.filesize(True) > 10 # Clear data from memory data._data = None # Load it again from disk data.load_data(True) assert data._data == CONTENTS assert data.as_text() == CONTENTS
def test_api_url_without_php_ending_with_trailing_slash(): with wrap(): with open(".dexyapis", "wb") as f: json.dump({ "wordpress" : {"url" : "http://example.com/api/"} }, f) url = dexy.filter.Filter.create_instance("wp").api_url() assert url == "http://example.com/api/xmlrpc.php"
def test_split_html_filter(): with wrap() as wrapper: contents=""" <p>This is at the top.</p> <!-- split "a-page" --> some content on a page <!-- split "another-page" --> some content on another page <!-- endsplit --> bottom """ node = Doc("subdir/example.html|splithtml", wrapper, [], contents=contents) wrapper.run_docs(node) assert node.children[0].key == "subdir/a-page.html" assert node.children[1].key == "subdir/another-page.html" od = str(node.output_data()) assert "<p>This is at the top.</p>" in od assert '<a href="a-page.html">' in od assert '<a href="another-page.html">' in od assert "bottom" in od od = str(node.children[0].output_data()) assert "<p>This is at the top.</p>" in od assert "some content on a page" in od assert "bottom" in od od = str(node.children[1].output_data()) assert "<p>This is at the top.</p>" in od assert "some content on another page" in od assert "bottom" in od
def test_api_url_without_php_ending_with_trailing_slash(): with wrap() as wrapper: with open(".dexyapis", "wb") as f: json.dump({ "wordpress" : {"url" : "http://example.com/api/"} }, f) url = WordPressFilter.api_url() assert url == "http://example.com/api/xmlrpc.php"
def test_jinja_undefined(): with wrap() as wrapper: wrapper.debug = False node = Doc("template.txt|jinja", wrapper, [], contents="""{{ foo }}""") wrapper.run_docs(node) assert wrapper.state == 'error'
def test_generated_files_added_latex_log_ext_array(): with wrap() as wrapper: doc = DocNode("example.tex|latex", contents=LATEX, latex={'add-new-files': ['.log']}, wrapper=wrapper) wrapper.run_docs(doc)
def test_generated_files_not_added_by_default(): with wrap() as wrapper: doc = DocNode( "generate-data.py|py", contents="""with open("abc.txt", "w") as f: f.write("hello")""", wrapper=wrapper) wrapper.run_docs(doc)
def test_text_parser(): with wrap() as wrapper: with open("f1.py", "w") as f: f.write("print 'hello'") with open("f2.py", "w") as f: f.write("print 'hello'") with open("index.md", "w") as f: f.write("") wrapper = Wrapper() wrapper.to_valid() wrapper.nodes = {} wrapper.roots = [] wrapper.batch = dexy.batch.Batch(wrapper) wrapper.filemap = wrapper.map_files() ast = AbstractSyntaxTree(wrapper) parser = TextFile(wrapper, ast) parser.parse( ".", """ *.py *.py|pyg *.md|jinja """) ast.walk() assert len(wrapper.nodes) == 8
def test_generated_files_added_latex_log_ext_array(): with wrap() as wrapper: doc = DocNode("example.tex|latex", contents = LATEX, latex = {'add-new-files' : ['.log']}, wrapper=wrapper) wrapper.run_docs(doc)
def test_regetron_filter(): with wrap() as wrapper: wrapper.debug = False node = Doc("example.regex|regetron", wrapper, [ Doc("input1.txt", wrapper, [], contents=REGETRON_INPUT_1), Doc("input2.txt", wrapper, [], contents=REGETRON_INPUT_2) ], contents="^[a-z\s]+$" ) wrapper.run_docs(node) if not wrapper.state == 'error': assert str(node.output_data()['input1.txt']) == """\ > ^[a-z\s]+$ 0000: hello > """ assert str(node.output_data()['input2.txt']) == """\
def test_split_html_filter(): with wrap() as wrapper: contents=""" <p>This is at the top.</p> <!-- split "a-page" --> some content on a page <!-- split "another-page" --> some content on another page <!-- endsplit --> bottom """ doc = Doc("subdir/example.html|splithtml", contents=contents, wrapper=wrapper) wrapper.docs = [doc] wrapper.run() assert doc.children[2].key == "subdir/a-page.html" assert doc.children[3].key == "subdir/another-page.html" od = doc.output().data() assert "<p>This is at the top.</p>" in od assert '<a href="a-page.html">' in od assert '<a href="another-page.html">' in od assert "bottom" in od assert "<p>This is at the top.</p>" in doc.children[2].output().data() assert "some content on a page" in doc.children[2].output().data() assert "bottom" in doc.children[2].output().data() assert "<p>This is at the top.</p>" in doc.children[3].output().data() assert "some content on another page" in doc.children[3].output().data() assert "bottom" in doc.children[3].output().data()
def test_archive_filter_with_short_names(): with wrap() as wrapper: with open("hello.py", "w") as f: f.write("print 'hello'") with open("hello.rb", "w") as f: f.write("puts 'hello'") doc = Doc("archive.tgz|archive", Doc("hello.py", wrapper=wrapper), Doc("hello.rb", wrapper=wrapper), Doc("hello.py|pyg", wrapper=wrapper), Doc("hello.rb|pyg", wrapper=wrapper), contents=" ", archive={'use-short-names' : True}, wrapper=wrapper) wrapper.docs = [doc] wrapper.run() wrapper.report() assert os.path.exists("output/archive.tgz") with tarfile.open("output/archive.tgz", mode="r:gz") as tar: names = tar.getnames() assert "archive/hello.py" in names assert "archive/hello.rb" in names assert "archive/hello.html" in names
def test_doc_setup(): with wrap() as wrapper: doc = Doc("abc.txt|dexy|dexy", wrapper=wrapper) assert doc.key == "abc.txt|dexy|dexy" assert doc.name == "abc.txt" assert doc.filters == ["dexy", "dexy"] assert doc.children[0].key == "abc.txt" assert doc.children[1].key == "abc.txt|dexy" assert doc.children[2].key == "abc.txt|dexy|dexy" assert doc.children[0].__class__.__name__ == "InitialVirtualArtifact" assert doc.children[1].__class__.__name__ == "FilterArtifact" assert doc.children[2].__class__.__name__ == "FilterArtifact" assert not hasattr(doc.children[0], 'next_filter_alias') assert doc.children[1].next_filter_alias == "dexy" assert doc.children[2].next_filter_alias == None assert not doc.children[0].prior assert doc.children[1].prior.__class__.__name__ == "InitialVirtualArtifact" assert doc.children[2].prior.__class__.__name__ == "FilterArtifact" assert not doc.children[0].prior assert doc.children[1].prior.key == "abc.txt" assert doc.children[2].prior.key == "abc.txt|dexy"
def test_archive_filter_with_short_names(): with wrap() as wrapper: with open("hello.py", "w") as f: f.write("print 'hello'") with open("hello.rb", "w") as f: f.write("puts 'hello'") wrapper = Wrapper() wrapper.create_dexy_dirs() wrapper = Wrapper() doc = Doc("archive.tgz|archive", wrapper, [ Doc("hello.py", wrapper), Doc("hello.rb", wrapper), Doc("hello.py|pyg", wrapper), Doc("hello.rb|pyg", wrapper) ], contents=" ", archive={'use-short-names': True}) wrapper.run_docs(doc) wrapper.report() assert os.path.exists("output/archive.tgz") tar = tarfile.open("output/archive.tgz", mode="r:gz") names = tar.getnames() assert "archive/hello.py" in names assert "archive/hello.rb" in names assert "archive/hello.py.html" in names assert "archive/hello.rb.html" in names tar.close()
def test_update_task(): with wrap() as wrapper: attrs = { "args" : {}, "doc.key" : "abc23456", "key_with_batch_id.return_value" : "def1234556", "wrapper.batch_id" : 1001, "hashstring" : "abc123001", "created_by_doc" : None, "output_data_type" : "generic", "ext" : ".txt", "output_data.storage_type" : "generic", "key" : "file.txt" } task = MagicMock(**attrs) wrapper.db.add_task_before_running(task) wrapper.db.conn.commit() wrapper.db.update_task_after_running(task) sql = """select * from tasks""" wrapper.db.cursor.execute(sql) row = wrapper.db.cursor.fetchone() assert row['hashstring'] == 'abc123001'
def test_javac_filter(): with wrap() as wrapper: doc = Doc("hello.java|javac", contents=JAVA_SRC, wrapper=wrapper) wrapper.docs = [doc] wrapper.run()
def test_script_node_caching__slow(): with wrap(): with open("start.sh", "w") as f: f.write("pwd") with open("middle.sh", "w") as f: f.write("echo `time`") with open("end.sh", "w") as f: f.write("echo 'done'") with open("dexy.yaml", "w") as f: f.write(SCRIPT_YAML) wrapper1 = Wrapper() wrapper1.run_from_new() for node in wrapper1.nodes.values(): assert node.state == 'ran' wrapper2 = Wrapper() wrapper2.run_from_new() for node in wrapper2.nodes.values(): assert node.state == 'consolidated' time.sleep(1.1) with open("middle.sh", "w") as f: f.write("echo 'new'") wrapper3 = Wrapper() wrapper3.run_from_new() for node in wrapper1.nodes.values(): assert node.state == 'ran'
def test_pattern_node(): with wrap() as wrapper: with open("foo.txt", "w") as f: f.write("foo!") with open("bar.txt", "w") as f: f.write("bar!") wrapper = Wrapper(log_level='DEBUG') wrapper.to_valid() wrapper.nodes = {} wrapper.roots = [] wrapper.batch = dexy.batch.Batch(wrapper) wrapper.filemap = wrapper.map_files() node = PatternNode("*.txt", wrapper, [], foo="bar") assert node.args['foo'] == 'bar' wrapper.run_docs(node) assert len(node.children) == 2 for child in node.children: assert child.__class__.__name__ == "Doc" assert child.args['foo'] == 'bar' assert child.key_with_class() in ["doc:foo.txt", "doc:bar.txt"] assert child.filters == []
def test_add_task(): with wrap() as wrapper: attrs = { "args" : {}, "doc.key" : "abc23456", "key_with_batch_id.return_value" : "def1234556", "wrapper.batch_id" : 1001, "state" : "running", "created_by_doc" : None, "key" : "file.txt" } task = MagicMock(**attrs) wrapper.db.add_task_before_running(task) wrapper.db.conn.commit() sql = """select * from tasks""" wrapper.db.cursor.execute(sql) row = wrapper.db.cursor.fetchone() assert row['batch_id'] == 1001 assert row['key'] == "file.txt" assert row['class_name'] == "MagicMock" assert row['started_at'] < datetime.now() assert not row['created_by_doc'] assert wrapper.db.next_batch_id() == 1002
def test_single_bundle_doc_with_args_2(): with wrap() as wrapper: wrapper.nodes = {} wrapper.roots = [] wrapper.batch = dexy.batch.Batch(wrapper) wrapper.filemap = wrapper.map_files() ast = AbstractSyntaxTree(wrapper) parser = Yaml(wrapper, ast) parser.parse( '.', """ - hello: - foo: bar - filter_fruit: orange - args: - ping: pong - another-task: - foo: baz - yet-another-task: - foo: bar - one-more-task - more: - hello - one-more-task - foo: bar """) ast.walk() assert wrapper.roots[0].key_with_class() == "bundle:more" assert len(wrapper.nodes) == 5
def test_ragel_state_chart_to_image(): ragel = inspect.cleandoc(""" %%{ machine hello_and_welcome; main := ( 'h' @ { puts "hello world!" } | 'w' @ { puts "welcome" } )*; }%% data = 'whwwwwhw' %% write data; %% write init; %% write exec; """) with wrap() as wrapper: graph_png = dexy.doc.Doc("example.rl|rlrbd|dot", wrapper, [], contents=ragel ) syntax = dexy.doc.Doc("example.rl|rlrbd|pyg", wrapper, [], contents=ragel ) wrapper.run_docs(graph_png, syntax) assert graph_png.state == 'ran' assert syntax.state == 'ran'
def test_generated_files_added_latex(): with wrap() as wrapper: doc = DocNode("example.tex|latex", contents=LATEX, latex={'add-new-files': True}, wrapper=wrapper) wrapper.run_docs(doc)
def test_generated_files_added_latex(): with wrap() as wrapper: doc = DocNode("example.tex|latex", contents = LATEX, latex = {'add-new-files' : True}, wrapper=wrapper) wrapper.run_docs(doc)
def test_generated_files_with_additional_filters(): with wrap() as wrapper: doc = DocNode("example.tex|latex", contents = LATEX, latex = {'add-new-files' : ['.aux'], 'additional-doc-filters' : { '.aux' : 'wc' } }, wrapper=wrapper) wrapper.run_docs(doc)
def test_generated_files_added_when_requested_underscore(): with wrap() as wrapper: doc = DocNode("generate-data.py|py", contents = """with open("abc.txt", "w") as f: f.write("hello")""", py={"add_new_files" : True}, wrapper=wrapper) wrapper.run_docs(doc)
def test_yamlargs_with_caching(): with wrap() as wrapper: doc = Doc("example.txt|yamlargs", wrapper, [], contents = "title: My Title\n---\r\nThis is the content." ) wrapper.run_docs(doc) task = wrapper.nodes["doc:example.txt|yamlargs"] assert task.output_data().title() == "My Title" assert task.state == 'ran' wrapper = Wrapper() doc = Doc("example.txt|yamlargs", wrapper, [], contents = "title: My Title\n---\r\nThis is the content." ) wrapper.run_docs(doc) task = wrapper.nodes["doc:example.txt|yamlargs"] assert task.output_data().title() == "My Title" assert task.state == 'consolidated' wrapper = Wrapper() doc = Doc("example.txt|yamlargs", wrapper, [], contents = "title: My Title\n---\r\nThis is the content." ) wrapper.run_docs(doc) task = wrapper.nodes["doc:example.txt|yamlargs"] assert task.output_data().title() == "My Title" assert task.state == 'consolidated'
def test_yamlargs_filterargs(): with wrap() as wrapper: doc = Doc("example.txt|yamlargs|filterargs", wrapper, [], contents = "%s\n---\r\nThis is the content." % YAML, ) wrapper.run_docs(doc) output = doc.output_data().as_text() assert "abc: xyz" in output assert "foo: 5" in output wrapper = Wrapper() doc = Doc("example.txt|yamlargs|filterargs", wrapper, [], contents = "%s\n---\r\nThis is the content." % YAML, ) wrapper.run_docs(doc) output = doc.output_data().as_text() assert "abc: xyz" in output assert "foo: 5" in output
def test_create_virtual_initial_artifact_with_dict(): with wrap() as wrapper: od_contents = OrderedDict() od_contents['1'] = "these are the contents" doc = Doc("abc.txt", contents = od_contents, wrapper=wrapper) wrapper.run_tasks(doc) assert doc.children[0].output_data.__class__.__name__ == "SectionedData"
def test_single_bundle_doc_with_args_2(): with wrap() as wrapper: wrapper.nodes = {} wrapper.roots = [] wrapper.batch = dexy.batch.Batch(wrapper) wrapper.filemap = wrapper.map_files() ast = AbstractSyntaxTree(wrapper) parser = Yaml(wrapper, ast) parser.parse('.', """ - hello: - foo: bar - filter_fruit: orange - args: - ping: pong - another-task: - foo: baz - yet-another-task: - foo: bar - one-more-task - more: - hello - one-more-task - foo: bar """) ast.walk() assert wrapper.roots[0].key_with_class() == "bundle:more" assert len(wrapper.nodes) == 5
def test_text_parser_blank_lines(): with wrap() as wrapper: parser = TextFileParser() parser.wrapper = wrapper parser.parse("\n\n") docs = wrapper.docs assert len(docs) == 0
def test_generic_data(): with wrap() as wrapper: wrapper.to_walked() wrapper.to_checked() CONTENTS = "contents go here" # Create a GenericData object settings = {'canonical-name': 'doc.txt'} data = dexy.data.Generic("doc.txt", ".txt", "abc000", settings, wrapper) data.setup_storage() # Assign some text contents data._data = CONTENTS assert data.has_data() assert not data.is_cached(True) # Save data to disk data.save() assert data.has_data() assert data.is_cached(True) assert data.filesize(True) > 10 # Clear data from memory data._data = None # Load it again from disk data.load_data(True) assert data._data == CONTENTS assert data.as_text() == CONTENTS
def test_subdir_config_with_bundle(): with wrap(): with open("dexy.yaml", "w") as f: f.write(""" foo: - .txt """) os.makedirs("abc/def") with open("abc/def/dexy.yaml", "w") as f: f.write(""" bar: - .py """) with open("abc/def/hello.py", "w") as f: f.write("print 'hello'") wrapper = Wrapper() wrapper.run_from_new() assert "doc:abc/def/hello.py" in wrapper.nodes wrapper = Wrapper(recurse=False) wrapper.run_from_new() assert not "doc:abc/def/hello.py" in wrapper.nodes wrapper = Wrapper(recurse=False, configs="abc/def/dexy.yaml") wrapper.run_from_new() assert "doc:abc/def/hello.py" in wrapper.nodes
def test_unprocessed_directory_archive_filter(): with wrap() as wrapper: with open("abc.txt", "w") as f: f.write('this is abc') with open("def.txt", "w") as f: f.write('this is def') wrapper = Wrapper() wrapper.create_dexy_dirs() wrapper = Wrapper() doc = Doc("archive.tgz|tgzdir", wrapper, [], contents="ignore", tgzdir={'dir': '.'}) wrapper.run_docs(doc) wrapper.report() assert os.path.exists("output/archive.tgz") tar = tarfile.open("output/archive.tgz", mode="r:gz") names = tar.getnames() assert ("./abc.txt" in names) or ("abc.txt" in names) assert ("./def.txt" in names) or ("def.txt" in names) tar.close()
def test_doc_node_with_filters(): with wrap() as wrapper: node = Node.create_instance('doc', "foo.txt|outputabc", wrapper, [], contents='foo') assert node.key_with_class() == "doc:foo.txt|outputabc"
def test_text_parser(): with wrap() as wrapper: with open("f1.py", "w") as f: f.write("print 'hello'") with open("f2.py", "w") as f: f.write("print 'hello'") with open("index.md", "w") as f: f.write("") wrapper = Wrapper() wrapper.to_valid() wrapper.nodes = {} wrapper.roots = [] wrapper.batch = dexy.batch.Batch(wrapper) wrapper.filemap = wrapper.map_files() ast = AbstractSyntaxTree(wrapper) parser = TextFile(wrapper, ast) parser.parse(".", """ *.py *.py|pyg *.md|jinja """) ast.walk() assert len(wrapper.nodes) == 8
def test_doc_node_populate(): with wrap() as wrapper: node = Node.create_instance( 'doc', "foo.txt", wrapper, [], contents='foo') assert node.key_with_class() == "doc:foo.txt"
def test_gif(): with wrap() as wrapper: doc = Doc("example.py|pyg|gn", contents="print 'hello'\n", wrapper=wrapper) wrapper.docs = [doc] wrapper.run()
def test_initial_artifact_hash(): with wrap() as wrapper: filename = "source.txt" with open(filename, "w") as f: f.write("hello this is some text") artifact = InitialArtifact(filename, wrapper=wrapper) artifact.name = filename artifact.run() first_hashstring = artifact.hashstring time.sleep(1.1) # make sure mtime is at least 1 second different with open(filename, "w") as f: f.write("hello this is different text") artifact = InitialArtifact(filename, wrapper=wrapper) artifact.name = filename artifact.run() second_hashstring = artifact.hashstring assert first_hashstring != second_hashstring
def test_cfussy_filter(): assert_output('cfussy', C_FUSSY_HELLO_WORLD, "HELLO, world\n", ext=".c") with wrap() as wrapper: wrapper.debug = False doc = Doc("hello.c|cfussy", contents=C_HELLO_WORLD, wrapper=wrapper) wrapper.run_docs(doc) assert wrapper.state == 'error'
def test_zip_archive_filter(): with wrap() as wrapper: with open("hello.py", "w") as f: f.write("print 'hello'") with open("hello.rb", "w") as f: f.write("puts 'hello'") doc = Doc("archive.zip|zip", Doc("hello.py", wrapper=wrapper), Doc("hello.rb", wrapper=wrapper), Doc("hello.py|pyg", wrapper=wrapper), Doc("hello.rb|pyg", wrapper=wrapper), contents=" ", wrapper=wrapper) wrapper.docs = [doc] wrapper.run() wrapper.report() assert os.path.exists("output/archive.zip") with zipfile.ZipFile("output/archive.zip", "r") as z: names = z.namelist() assert "archive/hello.py" in names assert "archive/hello.rb" in names assert "archive/hello.py-pyg.html" in names assert "archive/hello.rb-pyg.html" in names
def test_taverna(): raise SkipTest() with wrap() as wrapper: orig = os.path.join(TEST_DATA_DIR, 'simple_python_example_285475.t2flow') shutil.copyfile(orig, 'simple-python.t2flow') node = Doc("simple-python.t2flow|taverna", wrapper) wrapper.run_docs(node)
def run_calibre(ext): with wrap() as wrapper: node = Doc("book.html|calibre", wrapper, [], calibre={'ext': ext}, contents=HTML) wrapper.run_docs(node) assert node.output_data().is_cached()
def test_output_reporter(): with wrap() as wrapper: wrapper.reports = "output" doc = Doc("hello.txt", wrapper, [], contents="hello") wrapper.run_docs(doc) wrapper.report() assert os.path.exists("output") assert os.path.exists("output/hello.txt")
def test_nonzero_exit(): with wrap() as wrapper: wrapper.debug = False node = Doc("example.py|py", wrapper, [], contents="import sys\nsys.exit(1)") wrapper.run_docs(node) assert wrapper.state == 'error'
def test_sed_filter_single_simple_input_file(): with wrap() as wrapper: node = Doc("example.sed|sed", wrapper, [Doc("input.txt", wrapper, [], contents="hello")], contents="s/e/E/g") wrapper.run_docs(node) assert str(node.output_data()) == "hEllo"
def test_word_wrap_filter(): with wrap() as wrapper: node = Doc("example.txt|wrap", wrapper, [], contents="this is a line of text", wrap={"width": 5}) wrapper.run_docs(node) assert str(node.output_data()) == "this\nis a\nline\nof\ntext"
def test_doc_node_populate(): with wrap() as wrapper: node = Node.create_instance('doc', "foo.txt", wrapper, [], contents='foo') assert node.key_with_class() == "doc:foo.txt"
def test_ignore_nonzero_exit(): with wrap() as wrapper: wrapper.ignore_nonzero_exit = True node = Doc("example.py|py", wrapper, [], contents="import sys\nsys.exit(1)") wrapper.run_docs(node) assert True # no NonzeroExit was raised...
def test_globals(): with wrap() as wrapper: wrapper.globals = "foo=bar" node = Doc("hello.txt|testglobals", wrapper, [], contents="hello") wrapper.run_docs(node) env = node.filters[-1].run_plugins() assert env['foo'] == 'bar'
def test_idio_invalid_input(): with wrap() as wrapper: wrapper.debug = False doc = Doc("hello.py|idio", wrapper, [], contents="### @ ") wrapper.run_docs(doc) assert wrapper.state == 'error'