Exemplo n.º 1
0
 def test_run_flake8(self):
     runner = CliRunner()
     with runner.isolated_filesystem():
         create_project_structure('test_project', Path('test_project'), {
             'PROJECT_NAME': 'test_project',
             'MODULE_NAME': 'test_project'
         })
         result = runner.invoke(cli, ['run', 'flake8', 'test_project'])
         assert result.exit_code == 0
Exemplo n.º 2
0
 def test_run_flake8_guess(self, mock_fpd):
     runner = CliRunner()
     mock_fpd.return_value = {'package': 'test_project'}
     with runner.isolated_filesystem():
         create_project_structure('test_project', Path('test_project'), {
             'PROJECT_NAME': 'test_project',
             'MODULE_NAME': 'test_project'
         })
         result = runner.invoke(cli, ['run', 'flake8'], input='\n')
         assert result.exit_code == 0
Exemplo n.º 3
0
    def test_run_tests(self):
        runner = CliRunner()
        with runner.isolated_filesystem() as fs:
            create_project_structure('test_project', Path('test_project'), {
                'PROJECT_NAME': 'test_project',
                'MODULE_NAME': 'test_project'
            })

            os.chdir(Path.cwd() / 'test_project')
            shell(find_python() + ' -m pip install -e .')
            result = runner.invoke(
                cli, ['run', 'tests', '-r', 'unittest', '-t', 'tests'])
            assert result.exit_code == 0

            result = runner.invoke(
                cli, ['run', 'tests', '-r', 'pytest', '-t', 'tests'])
            assert result.exit_code == 0
Exemplo n.º 4
0
    def test_deploy(self):
        runner = CliRunner()
        with unittest.mock.patch('manati.deploy.do_twine') as mock:
            instance = mock.return_value
            instance.method.return_value = 'OK'

            with runner.isolated_filesystem():
                create_project_structure('test_project',
                                         pathlib.Path('test_project'), {
                                             'PROJECT_NAME': 'test_project',
                                             'MODULE_NAME': 'test_project'
                                         })

                os.chdir(pathlib.Path.cwd() / 'test_project')
                shell('mkdir build dist')
                result = runner.invoke(cli, ['deploy', 'pypi'], input='y\n')
                assert result.exit_code == 0