예제 #1
0
파일: test_wrapper.py 프로젝트: dexy/dexy
def test_assert_dexy_dirs():
    with tempdir():
        wrapper = Wrapper()
        try:
            wrapper.assert_dexy_dirs_exist()
            assert False
        except UserFeedback:
            assert True
예제 #2
0
def test_assert_dexy_dirs():
    with tempdir():
        wrapper = Wrapper()
        try:
            wrapper.assert_dexy_dirs_exist()
            assert False
        except UserFeedback:
            assert True
예제 #3
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)
예제 #4
0
파일: test_wrapper.py 프로젝트: dexy/dexy
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)
예제 #5
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")
예제 #6
0
파일: test_wrapper.py 프로젝트: dexy/dexy
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")
예제 #7
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()
예제 #8
0
파일: test_wrapper.py 프로젝트: dexy/dexy
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()
예제 #9
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")
예제 #10
0
파일: test_wrapper.py 프로젝트: dexy/dexy
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")