Ejemplo n.º 1
0
def test_remove_trash_with_trash():
    with tempdir():
        wrapper = Wrapper()
        os.mkdir(".trash")
        assert os.path.exists(".trash")
        wrapper.empty_trash()
        assert not os.path.exists(".trash")
Ejemplo n.º 2
0
def test_output_validatity(v, filename, linter):
    file_type = guess_type(filename)
    with tempdir():
        CliVersion(v).write(filename, file_type)
        retval = call(linter.split() + [filename, ],
                      stdout=PIPE, stderr=PIPE)
        expect_from_data(filename, retval, 0)
Ejemplo n.º 3
0
def test_zip_archive_filter():
    with tempdir():
        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.zip|zip",
                  wrapper, [
                      Doc("hello.py", wrapper),
                      Doc("hello.rb", wrapper),
                      Doc("hello.py|pyg", wrapper),
                      Doc("hello.rb|pyg", wrapper)
                  ],
                  contents=" ")

        wrapper.run_docs(doc)
        wrapper.report()

        path_exists = os.path.exists("output/archive.zip")
        assert path_exists
        z = zipfile.ZipFile("output/archive.zip", "r")
        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
        z.close()
Ejemplo n.º 4
0
def test_config_file():
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("""{ "logfile" : "a.log" }""")

        wrapper = init_wrapper({'conf' : 'dexy.conf'})
        assert wrapper.log_file == "a.log"
Ejemplo n.º 5
0
def test_repo_from_invalid_path():
    with tempdir():
        try:
            repo, remote = repo_from_path(".")
            assert False
        except UserFeedback as e:
            assert "no git repository was found at '.'" in str(e)
Ejemplo n.º 6
0
def test_remove_trash_with_trash():
    with tempdir():
        wrapper = Wrapper()
        os.mkdir(".trash")
        assert os.path.exists(".trash")
        wrapper.empty_trash()
        assert not os.path.exists(".trash")
Ejemplo n.º 7
0
def test_config_file():
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("""{ "logfile" : "a.log" }""")

        wrapper = init_wrapper({'conf': 'dexy.conf'})
        assert wrapper.log_file == "a.log"
Ejemplo n.º 8
0
def test_zip_archive_filter():
    with tempdir():
        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.zip|zip",
                wrapper,
                [
                    Doc("hello.py", wrapper),
                    Doc("hello.rb", wrapper),
                    Doc("hello.py|pyg", wrapper),
                    Doc("hello.rb|pyg", wrapper)
                    ],
                contents=" ")

        wrapper.run_docs(doc)
        wrapper.report()

        path_exists = os.path.exists("output/archive.zip")
        assert path_exists
        z = zipfile.ZipFile("output/archive.zip", "r")
        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
        z.close()
Ejemplo n.º 9
0
def test_error_if_to_valid_called_without_dirs_setup():
    with tempdir():
        wrapper = Wrapper()
        try:
            wrapper.to_valid()
            assert False, "should not get here"
        except InternalDexyProblem:
            assert True
Ejemplo n.º 10
0
def test_conf_command_if_path_exists(stdout):
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("foo")
        assert os.path.exists("dexy.conf")
        dexy.commands.run()
        assert "dexy.conf already exists" in stdout.getvalue()
        assert "artifactsdir" in stdout.getvalue()
Ejemplo n.º 11
0
def test_init_wrapper():
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("artifactsdir: custom")

        modargs = {}
        wrapper = dexy.commands.utils.init_wrapper(modargs)
        assert wrapper.artifacts_dir == 'custom'
Ejemplo n.º 12
0
def test_error_if_to_valid_called_without_dirs_setup():
    with tempdir():
        wrapper = Wrapper()
        try:
            wrapper.to_valid()
            assert False, "should not get here"
        except InternalDexyProblem:
            assert True
Ejemplo n.º 13
0
def test_create_remove_dexy_dirs():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()
        wrapper.to_valid()
        assert wrapper.dexy_dirs_exist()
        wrapper.remove_dexy_dirs()
        assert not wrapper.dexy_dirs_exist()
Ejemplo n.º 14
0
def test_assert_dexy_dirs():
    with tempdir():
        wrapper = Wrapper()
        try:
            wrapper.assert_dexy_dirs_exist()
            assert False
        except UserFeedback:
            assert True
Ejemplo n.º 15
0
def test_assert_dexy_dirs():
    with tempdir():
        wrapper = Wrapper()
        try:
            wrapper.assert_dexy_dirs_exist()
            assert False
        except UserFeedback:
            assert True
Ejemplo n.º 16
0
def test_create_remove_dexy_dirs():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()
        wrapper.to_valid()
        assert wrapper.dexy_dirs_exist()
        wrapper.remove_dexy_dirs()
        assert not wrapper.dexy_dirs_exist()
Ejemplo n.º 17
0
def test_conf_command_if_path_exists(stdout):
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("foo")
        assert os.path.exists("dexy.conf")
        dexy.commands.run()
        assert "dexy.conf already exists" in stdout.getvalue()
        assert "artifactsdir" in stdout.getvalue()
Ejemplo n.º 18
0
def test_init_wrapper():
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("artifactsdir: custom")

        modargs = {}
        wrapper = dexy.commands.utils.init_wrapper(modargs)
        assert wrapper.artifacts_dir == "custom"
Ejemplo n.º 19
0
def test_deprecated_dot_dexy_file():
    with tempdir():
        with open(".dexy", 'w') as f:
            f.write("{}")
        wrapper = Wrapper()
        try:
            wrapper.assert_dexy_dirs_exist()
        except UserFeedback as e:
            assert "this format is no longer supported" in str(e)
Ejemplo n.º 20
0
def test_setup_with_dexy_conf_file():
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("artifactsdir: custom")

        dexy.commands.run()
        assert os.path.exists("custom")
        assert os.path.isdir("custom")
        assert not os.path.exists("artifacts")
Ejemplo n.º 21
0
def test_deprecated_dot_dexy_file():
    with tempdir():
        with open(".dexy", 'w') as f:
            f.write("{}")
        wrapper = Wrapper()
        try:
            wrapper.assert_dexy_dirs_exist()
        except UserFeedback as e:
            assert "this format is no longer supported" in str(e)
Ejemplo n.º 22
0
def test_setup_with_dexy_conf_file():
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("artifactsdir: custom")

        dexy.commands.run()
        assert os.path.exists("custom")
        assert os.path.isdir("custom")
        assert not os.path.exists("artifacts")
Ejemplo n.º 23
0
def test_parse_doc_configs_no_configs():
    with tempdir():
        with capture_stdout() as stdout:
            wrapper = Wrapper()
            wrapper.create_dexy_dirs()

            wrapper = Wrapper()
            wrapper.to_valid()
            wrapper.to_walked()
            value = stdout.getvalue()
        assert "didn't find any document config files" in value
Ejemplo n.º 24
0
def test_parse_doc_configs_no_configs():
    with tempdir():
        with capture_stdout() as stdout:
            wrapper = Wrapper()
            wrapper.create_dexy_dirs()

            wrapper = Wrapper()
            wrapper.to_valid()
            wrapper.to_walked()
            value = stdout.getvalue()
        assert "didn't find any document config files" in value
Ejemplo n.º 25
0
def test_kwargs_override_config_file():
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("""{ "logfile" : "a.log" }""")

        wrapper = init_wrapper({
            '__cli_options' : { 'logfile' : 'b.log' },
            'logfile' : "b.log",
            'conf' : 'dexy.conf'
            })
        assert wrapper.log_file == "b.log"
Ejemplo n.º 26
0
def test_move_cache_dir():
    with capture_stdout() as stdout:
        with tempdir():
            os.mkdir(".cache")
            with open(".cache/.dexy-generated", 'w') as f:
                f.write("")

            wrapper = Wrapper()
            wrapper.assert_dexy_dirs_exist()

            assert "Moving directory '.cache'" in stdout.getvalue()
            assert not os.path.exists(".cache")
            assert os.path.exists(".dexy")
Ejemplo n.º 27
0
def test_kwargs_override_config_file():
    with tempdir():
        with open("dexy.conf", "w") as f:
            f.write("""{ "logfile" : "a.log" }""")

        wrapper = init_wrapper({
            '__cli_options': {
                'logfile': 'b.log'
            },
            'logfile': "b.log",
            'conf': 'dexy.conf'
        })
        assert wrapper.log_file == "b.log"
Ejemplo n.º 28
0
def test_walked():
    with tempdir():
        with open("dexy.yaml", "w") as f:
            f.write("foo.txt")

        with open("foo.txt", "w") as f:
            f.write("foo")

        wrapper = Wrapper()
        wrapper.create_dexy_dirs()
        wrapper.to_valid()
        wrapper.to_walked()
        wrapper.validate_state('walked')
Ejemplo n.º 29
0
def test_move_cache_dir():
    with capture_stdout() as stdout:
        with tempdir():
            os.mkdir(".cache")
            with open(".cache/.dexy-generated", 'w') as f:
                f.write("")
    
            wrapper = Wrapper()
            wrapper.assert_dexy_dirs_exist()
    
            assert "Moving directory '.cache'" in stdout.getvalue()
            assert not os.path.exists(".cache")
            assert os.path.exists(".dexy")
Ejemplo n.º 30
0
def test_walked():
    with tempdir():
        with open("dexy.yaml", "w") as f:
            f.write("foo.txt")

        with open("foo.txt", "w") as f:
            f.write("foo")

        wrapper = Wrapper()
        wrapper.create_dexy_dirs()
        wrapper.to_valid()
        wrapper.to_walked()
        wrapper.validate_state('walked')
Ejemplo n.º 31
0
def test_batch():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()

        wrapper = Wrapper()
        batch = dexy.batch.Batch(wrapper)
        os.makedirs(batch.batch_dir())

        batch.save_to_file()
        assert batch.filename() in os.listdir(".dexy/batches")

        wrapper = Wrapper()
        batch = dexy.batch.Batch.load_most_recent(wrapper)
Ejemplo n.º 32
0
def test_parse_doc_configs_single_empty_config():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()

        with open("dexy.yaml", "w") as f:
            f.write("foo.txt")

        with open("foo.txt", "w") as f:
            f.write("foo")

        wrapper = Wrapper()
        wrapper.to_valid()
        wrapper.to_walked()
Ejemplo n.º 33
0
def test_parse_doc_configs_single_empty_config():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()

        with open("dexy.yaml", "w") as f:
            f.write("foo.txt")

        with open("foo.txt", "w") as f:
            f.write("foo")

        wrapper = Wrapper()
        wrapper.to_valid()
        wrapper.to_walked()
Ejemplo n.º 34
0
def test_batch():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()

        wrapper = Wrapper()
        batch = dexy.batch.Batch(wrapper)
        os.makedirs(batch.batch_dir())

        batch.save_to_file()
        assert batch.filename() in os.listdir(".dexy/batches")

        wrapper = Wrapper()
        batch = dexy.batch.Batch.load_most_recent(wrapper)
Ejemplo n.º 35
0
def test_old_cache_dir_with_settings():
    with capture_stdout() as stdout:
        with tempdir():
            os.mkdir(".cache")

            with open(".cache/.dexy-generated", 'w') as f:
                f.write("")

            wrapper = Wrapper(artifacts_dir=".cache")
            wrapper.assert_dexy_dirs_exist()

            assert os.path.exists(".cache")
            assert not os.path.exists(".dexy")

            assert "You may have a dexy.conf file" in stdout.getvalue()
Ejemplo n.º 36
0
def test_init_wrapper_if_dexy_dirs_exist():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()

        with open("hello.txt", "w") as f:
            f.write("hello")

        wrapper = Wrapper()
        wrapper.to_valid()
        assert wrapper.project_root
        wrapper.to_walked()
        assert 'hello.txt' in wrapper.filemap
        assert 'dexy.log' in os.listdir('.dexy')
        assert not '.dexy/dexy.log' in wrapper.filemap
Ejemplo n.º 37
0
def test_init_wrapper_if_dexy_dirs_exist():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()

        with open("hello.txt", "w") as f:
            f.write("hello")

        wrapper = Wrapper()
        wrapper.to_valid()
        assert wrapper.project_root
        wrapper.to_walked()
        assert 'hello.txt' in wrapper.filemap
        assert 'dexy.log' in os.listdir('.dexy')
        assert not '.dexy/dexy.log' in wrapper.filemap
Ejemplo n.º 38
0
def test_old_cache_dir_with_settings():
    with capture_stdout() as stdout:
        with tempdir():
            os.mkdir(".cache")

            with open(".cache/.dexy-generated", 'w') as f:
                f.write("")
    
            wrapper = Wrapper(artifacts_dir = ".cache")
            wrapper.assert_dexy_dirs_exist()

            assert os.path.exists(".cache")
            assert not os.path.exists(".dexy")
    
            assert "You may have a dexy.conf file" in stdout.getvalue()
Ejemplo n.º 39
0
def test_batch_with_docs():
    with tempdir():
        wrapper = Wrapper(log_level='DEBUG', debug=True)
        wrapper.create_dexy_dirs()

        with open("hello.txt", "w") as f:
            f.write("hello")

        with open("dexy.yaml", "w") as f:
            f.write("hello.txt")

        wrapper = Wrapper()
        wrapper.run_from_new()

        batch = dexy.batch.Batch.load_most_recent(wrapper)
        assert batch

        for doc_key in batch.docs:
            assert batch.input_data(doc_key)
            assert batch.output_data(doc_key)
Ejemplo n.º 40
0
def test_batch_with_docs():
    with tempdir():
        wrapper = Wrapper(log_level='DEBUG', debug=True)
        wrapper.create_dexy_dirs()

        with open("hello.txt", "w") as f:
            f.write("hello")

        with open("dexy.yaml", "w") as f:
            f.write("hello.txt")

        wrapper = Wrapper()
        wrapper.run_from_new()

        batch = dexy.batch.Batch.load_most_recent(wrapper)
        assert batch

        for doc_key in batch.docs:
            assert batch.input_data(doc_key)
            assert batch.output_data(doc_key)
Ejemplo n.º 41
0
def test_ran():
    with tempdir():
        with open("dexy.yaml", "w") as f:
            f.write("foo.txt")

        with open("foo.txt", "w") as f:
            f.write("foo")

        wrapper = Wrapper()
        wrapper.create_dexy_dirs()
        wrapper.run_from_new()
        for node in wrapper.roots:
            assert node.state == 'ran'
        wrapper.validate_state('ran')

        wrapper = Wrapper()
        wrapper.run_from_new()
        for node in wrapper.roots:
            assert node.state == 'consolidated'
        wrapper.validate_state('ran')
Ejemplo n.º 42
0
def test_ran():
    with tempdir():
        with open("dexy.yaml", "w") as f:
            f.write("foo.txt")

        with open("foo.txt", "w") as f:
            f.write("foo")

        wrapper = Wrapper()
        wrapper.create_dexy_dirs()
        wrapper.run_from_new()
        for node in wrapper.roots:
            assert node.state == 'ran'
        wrapper.validate_state('ran')

        wrapper = Wrapper()
        wrapper.run_from_new()
        for node in wrapper.roots:
            assert node.state == 'consolidated'
        wrapper.validate_state('ran')
Ejemplo n.º 43
0
def test_nodexy_files():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()

        with open("hello.txt", "w") as f:
            f.write("hello")

        os.makedirs("s1/s2/s3")

        nodexy_path = "s1/s2/.nodexy"
        with open(nodexy_path, 'w') as f:
            f.write("dexy stop here")

        with open("s1/s2/ignore.txt", "w") as f:
            f.write("dexy should ignore this")

        with open("s1/s2/s3/ignore.txt", "w") as f:
            f.write("dexy should also ignore this")

        # Only the hello.txt file is visible to dexy
        wrapper = Wrapper()
        wrapper.to_valid()
        wrapper.to_walked()
        assert len(wrapper.filemap) == 1
        assert 'hello.txt' in wrapper.filemap

        os.remove(nodexy_path)

        # Now we can see all 3 text files.
        wrapper = Wrapper()
        wrapper.to_valid()
        wrapper.to_walked()
        assert len(wrapper.filemap) == 3
        assert 'hello.txt' in wrapper.filemap
        assert 's1/s2/ignore.txt' in wrapper.filemap
        assert 's1/s2/s3/ignore.txt' in wrapper.filemap
Ejemplo n.º 44
0
def test_nodexy_files():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()

        with open("hello.txt", "w") as f:
            f.write("hello")

        os.makedirs("s1/s2/s3")

        nodexy_path = "s1/s2/.nodexy"
        with open(nodexy_path, 'w') as f:
            f.write("dexy stop here")

        with open("s1/s2/ignore.txt", "w") as f:
            f.write("dexy should ignore this")

        with open("s1/s2/s3/ignore.txt", "w") as f:
            f.write("dexy should also ignore this")

        # Only the hello.txt file is visible to dexy
        wrapper = Wrapper()
        wrapper.to_valid()
        wrapper.to_walked()
        assert len(wrapper.filemap) == 1
        assert 'hello.txt' in wrapper.filemap

        os.remove(nodexy_path)

        # Now we can see all 3 text files.
        wrapper = Wrapper()
        wrapper.to_valid()
        wrapper.to_walked()
        assert len(wrapper.filemap) == 3
        assert 'hello.txt' in wrapper.filemap
        assert 's1/s2/ignore.txt' in wrapper.filemap
        assert 's1/s2/s3/ignore.txt' in wrapper.filemap
Ejemplo n.º 45
0
def test_cache_and_dexy_dirs_present():
    with tempdir():
        os.mkdir(".dexy")
        os.mkdir(".cache")
        with open(".dexy/.dexy-generated", 'w') as f:
            f.write("")
        with open(".cache/.dexy-generated", 'w') as f:
            f.write("")

        wrapper = Wrapper()

        try:
            wrapper.assert_dexy_dirs_exist()
        except UserFeedback as e:
            assert "Please remove '.cache'" in str(e)

        os.remove(".cache/.dexy-generated")
        wrapper.assert_dexy_dirs_exist()

        # Cache still exists but dexy just ignores it.
        assert os.path.exists(".cache")

        # Dexy uses .dexy dir
        assert os.path.exists(".dexy")
Ejemplo n.º 46
0
def test_cache_and_dexy_dirs_present():
    with tempdir():
        os.mkdir(".dexy")
        os.mkdir(".cache")
        with open(".dexy/.dexy-generated", 'w') as f:
            f.write("")
        with open(".cache/.dexy-generated", 'w') as f:
            f.write("")

        wrapper = Wrapper()

        try:
            wrapper.assert_dexy_dirs_exist()
        except UserFeedback as e:
            assert "Please remove '.cache'" in str(e)

        os.remove(".cache/.dexy-generated")
        wrapper.assert_dexy_dirs_exist()

        # Cache still exists but dexy just ignores it.
        assert os.path.exists(".cache")

        # Dexy uses .dexy dir
        assert os.path.exists(".dexy")
Ejemplo n.º 47
0
def test_remove_trash_no_trash():
    with tempdir():
        wrapper = Wrapper()
        wrapper.empty_trash()
Ejemplo n.º 48
0
def test_example_project():
    with tempdir():

        def run_from_cache_a_bunch_of_times():
            n = random.randint(2, 10)
            print "running %s times:" % n
            for i in range(n):
                print '', i + 1
                wrapper = Wrapper(log_level=LOGLEVEL, debug=True)
                wrapper.run_from_new()

                for node in wrapper.nodes.values():
                    assert_node_state(node, 'consolidated', "In iter %s" % i)

                wrapper.report()

        example_src = os.path.join(TEST_DATA_DIR, 'example')
        shutil.copytree(example_src, "example")
        os.chdir("example")

        wrapper = Wrapper(log_level=LOGLEVEL)
        wrapper.create_dexy_dirs()

        wrapper.run_from_new()
        wrapper.report()

        for node in wrapper.nodes.values():
            assert_node_state(node, 'ran', "in first run")

        run_from_cache_a_bunch_of_times()

        # touch this file so it triggers cache updating
        os.utime("multiply.py", None)

        unaffected_keys = (
            'latex',
            'pygments.sty|pyg',
            's1/loop.py|pycon',
            's1/loop.py|py',
            'main.rst|idio|h',
            'main.rst|idio|l',
            'main.rst|pyg|l',
            'main.rst|pyg|h',
            's1/loop.py|idio|h',
            's1/loop.py|idio|l',
            's1/loop.py|pyg|l',
            's1/loop.py|pyg|h',
            'dexy.yaml|idio|h',
            'dexy.yaml|idio|l',
            'dexy.yaml|pyg|l',
            'dexy.yaml|pyg|h',
        )

        affected_keys = (
            'code',
            'docs',
            "*|pyg|l",
            "*|pyg|h",
            "*|idio|l",
            "*|idio|h",
            "main.rst|jinja|rst|latex",
            "*.rst|jinja|rst|latex",
            "*.py|pycon",
            "*.py|py",
            "main.rst|jinja|rstbody|easyhtml",
            "*.rst|jinja|rstbody|easyhtml",
            "foo.txt",
            "multiply.py|idio|h",
            "multiply.py|idio|l",
            "multiply.py|pycon",
            "multiply.py|py",
            "multiply.py|pyg|h",
            "multiply.py|pyg|l",
        )

        wrapper = Wrapper(log_level=LOGLEVEL)
        wrapper.run_from_new()
        wrapper.report()

        for node in wrapper.nodes.values():
            if node.key in unaffected_keys:
                assert_node_state(node, 'consolidated',
                                  "after touching multiply.py")
            else:
                assert node.key in affected_keys, node.key
                assert_node_state(node, 'ran', "after touchimg multiply.py")

        run_from_cache_a_bunch_of_times()

        import time
        time.sleep(0.5)

        with open("multiply.py", "r") as f:
            old_content = f.read()

        with open("multiply.py", "w") as f:
            f.write("raise")

        wrapper = Wrapper(log_level=LOGLEVEL)
        wrapper.run_from_new()
        assert wrapper.state == 'error'

        import time
        time.sleep(0.9)

        with open("multiply.py", "w") as f:
            f.write(old_content)

        wrapper = Wrapper(log_level=LOGLEVEL)
        wrapper.run_from_new()

        for node in wrapper.nodes.values():
            if node.key in unaffected_keys:
                assert_node_state(node, 'consolidated',
                                  "after restoring old multiply.py content")
            else:
                assert node.key in affected_keys, node.key
                assert_node_state(node, 'ran',
                                  "after restoring old multiply.py contnet")

        wrapper.remove_dexy_dirs()
        wrapper.remove_reports_dirs(keep_empty_dir=True)
        wrapper.create_dexy_dirs()

        assert len(os.listdir(".dexy")) == 1

        wrapper = Wrapper(log_level=LOGLEVEL, dry_run=True)
        wrapper.run_from_new()
        wrapper.report()

        assert len(os.listdir(".dexy")) == 6

        with open(".dexy/reports/graph.txt", "r") as f:
            graph_text = f.read()

        assert "BundleNode(docs) (uncached)" in graph_text

        os.chdir("..")
Ejemplo n.º 49
0
def test_write_version_file(v, file):
    with tempdir():
        CliVersion(v).write(file, 'text')
        read = CliVersion.read(file)
        expect_from_data(file, read.as_dotted(), v)
Ejemplo n.º 50
0
def test_run_dexy(stdout):
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()
        dexy.commands.run()
Ejemplo n.º 51
0
def test_conf_command_with_print_option(stdout):
    with tempdir():
        dexy.commands.run()
        assert not os.path.exists("dexy.conf")
        assert "artifactsdir" in stdout.getvalue()
Ejemplo n.º 52
0
def test_state_valid_after_to_valid():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()
        wrapper.to_valid()
        wrapper.validate_state('valid')
Ejemplo n.º 53
0
def test_remove_trash_no_trash():
    with tempdir():
        wrapper = Wrapper()
        wrapper.empty_trash()
Ejemplo n.º 54
0
def test_python_compatibility(interp):
    with tempdir():
        CliVersion('1.0.1').write('test_wr.py', 'py')
        retval = call([interp, '-W', 'all', 'test_wr.py'], stdout=PIPE,
                      stderr=PIPE)
        expect_from_data('test_wr.py', retval, 0)
Ejemplo n.º 55
0
def test_cowsay():
    with tempdir():
        for batch in Cowsay().dexy():
            print batch
Ejemplo n.º 56
0
def test_cowsay():
    with tempdir():
        for batch in Cowsay().dexy():
            print batch
Ejemplo n.º 57
0
def test_run():
    with tempdir():
        DefaultTemplate().generate("test")
        assert not os.path.exists("dexy.rst")
Ejemplo n.º 58
0
def test_state_valid_after_to_valid():
    with tempdir():
        wrapper = Wrapper()
        wrapper.create_dexy_dirs()
        wrapper.to_valid()
        wrapper.validate_state('valid')