def test_git_diff_with_change(self): pkg_proj = [p for p in self.ctx.projects if p.name == 'pkg'][0] try: with pkg_proj.source_dir.joinpath('pyproject.toml').open('a') as f: print('', file=f) cmd = LsCommand(self.ctx, since='.') with captured_output() as (out, _): cmd.run() output = out.getvalue().strip() self.assertEqual(output, '[email protected]') finally: ChildProcess.run(f'git checkout {pkg_proj.source_dir}')
def test_task_install(self): install_cmd = InstallCommand(self.ctx) task_cmd = TaskCommand(self.ctx, task_name='test') self.assertEqual(len(task_cmd.ctx.projects), 1) with captured_output(stderr=False) as (out, _): install_cmd.run() task_cmd.run() output = out.getvalue() self.assertIn('Installing the current project: pkg', output) self.assertIn( 'Poe => python -m unittest discover -s tests -v -p "test_*.py"', output)
def test_match_filter(self): cmd = LsCommand(self.ctx, match=['labels.type=package']) with captured_output() as (out, _): cmd.run() output = out.getvalue().strip() self.assertEqual(output, '[email protected]')
def test_ignore_filter(self): cmd = LsCommand(self.ctx, ignore=['p*']) with captured_output() as (out, _): cmd.run() output = out.getvalue().strip() self.assertEqual(output, '')
def test_scope_filter(self): cmd = LsCommand(self.ctx, scope=['p*']) with captured_output() as (out, _): cmd.run() output = out.getvalue().strip() self.assertEqual(output, '[email protected]')
def test_git_diff(self): cmd = LsCommand(self.ctx, since='.') with captured_output() as (out, _): cmd.run() output = out.getvalue().strip() self.assertEqual(output, '')
def test_ls(self): cmd = LsCommand(self.ctx) with captured_output() as (out, _): cmd.run() output = out.getvalue().strip() self.assertEqual(output, '[email protected]')