def _run(self, config, cmd_options, cmd_args): self._require_args(cmd_args, 1) require_box(config) for sourcedir in cmd_args: sd = SourceDir(sourcedir) if cmd_options.clean_before: sd.clean() sd.build(config.box, cmd_options.suffix) if cmd_options.test: sd.unittest()
def test_build(): box = Box.create(box1_path) box2 = Box.create(box2_path) foo_path = os.path.join(sourcedirs_path, 'foo') foo_source = SourceDir(foo_path) assert foo_source.path == foo_path bar_path = os.path.join(sourcedirs_path, 'bar') bar_source = SourceDir(bar_path) foo = foo_source.build(box) bar = bar_source.build(box) foo_new = foo_source.build(box, name_suffix='-new') assert foo.enabled == False assert foo_new.enabled == True assert os.path.samefile(os.path.join(box.virtual_path, 'lib', 'd', 'foo'), os.path.join(foo_new.path, 'lib', 'd', 'foo')) assert foo_source.unittest() == True assert bar_source.unittest() == False foo_source.build(box2) # Should clean before assert len(list(box.packages(only_enabled=True))) == 2 box.disable_package(foo_new) assert not os.path.exists(os.path.join(box.virtual_path, 'lib', 'd', 'foo')) foo_source.clean() bar_source.clean()
def _run(self, config, cmd_options, cmd_args): self._require_args(cmd_args, 1) for sourcedir in cmd_args: sd = SourceDir(sourcedir) sd.unittest()
def _run(self, config, cmd_options, cmd_args): self._require_args(cmd_args, 1) for sourcedir in cmd_args: sd = SourceDir(sourcedir) sd.clean(cmd_options.deep)