예제 #1
0
파일: test_gdipak.py 프로젝트: 2pair/gdipak
    def test_single_dir_same_out_dir_default_args(self, tmpdir):
        dir_path, _1, exts = make_files(tmpdir, "mygame")
        g = Gdipak()
        g.pack_gdi(dir_path, dir_path)

        #dir name didn't change
        assert (tmpdir.listdir()[0] == dir_path)
        check_files(dir_path, exts)
예제 #2
0
파일: test_gdipak.py 프로젝트: 2pair/gdipak
 def test_recursive_dir_same_out_dir_mode_zero(self, tmpdir):
     dir_path, _1, exts = make_files(tmpdir, "mygame")
     make_files(dir_path, "some other game")
     g = Gdipak()
     g.pack_gdi(dir_path, dir_path, RecursiveMode.PRESERVE_STRUCTURE, False)
     check_files(dir_path, exts)
     with scandir(dir_path) as itr:
         for item in itr:
             if path.isdir(item):
                 check_files(item, exts)
예제 #3
0
파일: test_gdipak.py 프로젝트: 2pair/gdipak
 def test_recursive_dir_same_out_dir_mode_one(self, tmpdir):
     dir_path, _1, exts = make_files(tmpdir, "mygame")
     make_files(dir_path, "some other game")
     g = Gdipak()
     # mode is changed implicitly due to in_dir == out_dir
     g.pack_gdi(dir_path, dir_path, RecursiveMode.FLAT_STRUCTURE, False)
     check_files(dir_path, exts)
     with scandir(dir_path) as itr:
         for item in itr:
             if path.isdir(item):
                 check_files(item, exts)
예제 #4
0
파일: test_gdipak.py 프로젝트: 2pair/gdipak
 def test_recursive_dir_same_out_dir_mode_none(self, tmpdir):
     dir_path, _1, exts = make_files(tmpdir, "mygame")
     make_files(dir_path, "some other game")
     g = Gdipak()
     g.pack_gdi(dir_path, dir_path, None, False)
     check_files(dir_path, exts)
     with scandir(dir_path) as itr:
         for item in itr:
             if path.isdir(item):
                 # subdir was not touched
                 with pytest.raises(AssertionError):
                     check_files(item, exts)
예제 #5
0
파일: test_gdipak.py 프로젝트: 2pair/gdipak
    def test_single_dir_different_out_dir(self, tmpdir):
        in_dir, in_filenames, exts = make_files(tmpdir, "mygame")
        out_dir = tmpdir.mkdir("processed_game")
        g = Gdipak()
        g.pack_gdi(in_dir, out_dir)

        #src files didn't change
        with scandir(in_dir) as itr:
            for item in itr:
                assert (path.basename(item) in in_filenames)
        dir_path = path.join(out_dir, path.basename(in_dir))
        check_files(dir_path, exts)
예제 #6
0
파일: test_gdipak.py 프로젝트: 2pair/gdipak
    def test_recursive_dir_different_out_dir_mode_zero(self, tmpdir):
        sg_dir, _1, sg_exts = make_files(tmpdir, "some game")
        sog_dir, _1, sog_exts = make_files(sg_dir, "some other game")
        soog_dir, _1, soog_exts = make_files(sg_dir, "some other other game")
        sooog_dir, _1, sooog_exts = make_files(soog_dir,
                                               "some other other other game")
        out_dir = tmpdir.mkdir("processed_game")
        g = Gdipak()
        g.pack_gdi(sg_dir, out_dir, RecursiveMode.PRESERVE_STRUCTURE)

        sg_dir_path = path.join(out_dir, path.basename(sg_dir))
        check_files(sg_dir_path, sg_exts)
        sog_dir_path = path.join(sg_dir_path, path.basename(sog_dir))
        check_files(sog_dir_path, sog_exts)
        soog_dir_path = path.join(sg_dir_path, path.basename(soog_dir))
        check_files(soog_dir_path, soog_exts)
        sooog_dir_path = path.join(soog_dir_path, path.basename(sooog_dir))
        check_files(sooog_dir_path, sooog_exts)
예제 #7
0
    def test_recursive_dir_same_out_dir(self, tmpdir, monkeypatch):
        sg_dir, _1, sg_exts = make_files(tmpdir, "some game")
        sog_dir, _1, sog_exts = make_files(sg_dir, "some other game")
        soog_dir, _1, soog_exts = make_files(sg_dir, "some other other game")
        sooog_dir, _1, sooog_exts = make_files(soog_dir,
                                               "some other other other game")

        monkeypatch.setattr("gdipak.argv", ["pytest", "-d", str(sg_dir), "-m"])
        gdipak.main()

        sg_dir_path = path.join(tmpdir, path.basename(sg_dir))
        check_files(sg_dir_path, sg_exts)
        sog_dir_path = path.join(sg_dir, path.basename(sog_dir))
        check_files(sog_dir_path, sog_exts)
        soog_dir_path = path.join(sg_dir, path.basename(soog_dir))
        check_files(soog_dir_path, soog_exts)
        sooog_dir_path = path.join(soog_dir, path.basename(sooog_dir))
        check_files(sooog_dir_path, sooog_exts)
예제 #8
0
    def test_recursive_dir_different_out_dir_mode_zero(self, tmpdir,
                                                       monkeypatch):
        sg_dir, _1, sg_exts = make_files(tmpdir, "some game")
        sog_dir, _1, sog_exts = make_files(sg_dir, "some other game")
        soog_dir, _1, soog_exts = make_files(sg_dir, "some other other game")
        sooog_dir, _1, sooog_exts = make_files(soog_dir,
                                               "some other other other game")
        out_dir = tmpdir.mkdir("processed_game")

        monkeypatch.setattr(
            "gdipak.argv",
            ["pytest", "-d",
             str(sg_dir), "-o",
             str(out_dir), "-r", "0"])
        gdipak.main()

        sg_dir_path = path.join(out_dir, path.basename(sg_dir))
        check_files(sg_dir_path, sg_exts)
        sog_dir_path = path.join(sg_dir_path, path.basename(sog_dir))
        check_files(sog_dir_path, sog_exts)
        soog_dir_path = path.join(sg_dir_path, path.basename(soog_dir))
        check_files(soog_dir_path, soog_exts)
        sooog_dir_path = path.join(soog_dir_path, path.basename(sooog_dir))
        check_files(sooog_dir_path, sooog_exts)