Files
dvc/tests/test_pkg.py
T
Dmitry Petrov 70bc101571 [WIP] Pkg install (#1742)
* Download Git package

* Extract tmp git repo & fetch data

* Handle fetch\cloud errors and rename select option

* Modify gitignore files when deploy a package

* More tests for git ignore file. Fix an old issue.

* Raise and exception when .gitignor not in a file subdir

* Existing tests fixes

* Basic test for packages

* Comment out pkg tests

* Codeclimate improvements

* Reformatting

* Enable pkg tests

* Fix tests no Windows

* Another old bug fix

* Fix encoding issue on Windows

* Another windows fix: apply compat.str magic to file write

* Back to posix path in gitignore and apply compat.str magic to tests

* gitignorepath: OS specifix path to posix

* Forgotten assignment

* misc: cleanup small issues

Signed-off-by: Ruslan Kuprieiev <[email protected]>

* cli: pkg: hide from help

Signed-off-by: Ruslan Kuprieiev <[email protected]>
2019-03-20 04:09:12 +02:00

38 lines
1.3 KiB
Python

import os
from dvc.repo.pkg import Package, PackageParams
from tests.basic_env import TestDvcPkg
class TestPkgBasic(TestDvcPkg):
NEW_PKG_DIR = "new_pkg"
def setUp(self):
super(TestPkgBasic, self).setUp()
self.to_dir = os.path.join(self._root_dir, self.NEW_PKG_DIR)
os.mkdir(self.to_dir)
self.dvc.install_pkg(
PackageParams(self.pkg_fixture._root_dir, self.to_dir)
)
def test_installed_dirs_and_files(self):
self.assertTrue(os.path.isdir(self.pkg_dir))
mod_dir_fullpath = os.path.join(self._root_dir, Package.MODULES_DIR)
self.assertTrue(os.path.isdir(mod_dir_fullpath))
installed_pkg_dir = os.path.join(mod_dir_fullpath, self.GIT_PKG)
for file in [self.FOO, self.BAR, self.CODE]:
installed_file = os.path.join(installed_pkg_dir, file)
self.assertTrue(os.path.isfile(installed_file))
def test_target_dir_checkout(self):
pkg_data_file = os.path.join(self.to_dir, self.DATA)
self.assertTrue(os.path.exists(pkg_data_file))
self.assertTrue(os.path.isfile(pkg_data_file))
pkg_data_dir = os.path.join(self.to_dir, self.DATA_SUB_DIR)
self.assertTrue(os.path.exists(pkg_data_dir))
self.assertTrue(os.path.isdir(pkg_data_dir))