def test_pypi_error(sampleproject_dist, monkeypatch): command = [ "twine", "upload", "--repository-url", "https://test.pypi.org/legacy/", "--username", "foo", "--password", "bar", str(sampleproject_dist), ] monkeypatch.setattr(sys, "argv", command) message = ( re.escape(colorama.Fore.RED) + r"HTTPError: 403 Forbidden from https://test\.pypi\.org/legacy/\n" + r".+?authentication") result = dunder_main.main() assert re.match(message, result)
def test_exception_handling(monkeypatch): replaced_dispatch = pretend.raiser(exceptions.InvalidConfiguration("foo")) monkeypatch.setattr(cli, "dispatch", replaced_dispatch) assert dunder_main.main() == "InvalidConfiguration: foo"
def test_exception_handling(monkeypatch): replaced_dispatch = pretend.raiser(exceptions.InvalidConfiguration('foo')) monkeypatch.setattr(dunder_main, 'dispatch', replaced_dispatch) assert dunder_main.main() == 'InvalidConfiguration: foo'
def test_exception_handling(monkeypatch): replaced_dispatch = pretend.raiser(KeyError('foo')) monkeypatch.setattr(dunder_main, 'dispatch', replaced_dispatch) assert dunder_main.main() == 'KeyError: foo'
def test_no_color_exception(monkeypatch): monkeypatch.setattr(sys, "argv", ["twine", "--no-color", "upload", "missing.whl"]) message = "InvalidDistribution: Cannot find file (or expand pattern): 'missing.whl'" assert dunder_main.main() == message
def test_exception_handling(monkeypatch): monkeypatch.setattr(sys, "argv", ["twine", "upload", "missing.whl"]) message = "InvalidDistribution: Cannot find file (or expand pattern): 'missing.whl'" assert dunder_main.main( ) == colorama.Fore.RED + message + colorama.Style.RESET_ALL
'main', 'station_name', 'ticket_count', 'colored_text', ]) if '.py' == file_name[-3:] and file_name not in exclude else f1.read()) print('Shrinking finished!!') rmtree = shutil.rmtree mp.Process(target=rmtree, args=('dist', True)).start() mp.Process(target=rmtree, args=('build', True)).start() argv = sys.argv argv.append('bdist_wheel') # do not delete import setup import setup mp.Process(target=rmtree, args=('build', True)).start() # noinspection PyProtectedMember import pip._internal as pip for dir_path, _, file_names in os.walk('dist'): pip.main(fr'install -U --pre --force-reinstall dist/{file_names[0]}'. split()) break import twine.__main__ as twine argv[1:] = r'upload --verbose -u jerryc05 dist\*'.split() twine.main() input('All done!!')
def test_exception_handling(monkeypatch): replaced_dispatch = pretend.raiser( exceptions.InvalidConfiguration('foo') ) monkeypatch.setattr(dunder_main, 'dispatch', replaced_dispatch) assert dunder_main.main() == 'InvalidConfiguration: foo'