/
opt
/
imh-python
/
lib
/
python3.9
/
distutils
/
tests
/
/opt/imh-python/lib/python3.9/distutils/tests
mkdir
upload
Name
Size
Mode
Actions
__pycache__/
-
0755
rm
includetest.rst
25
0644
edit
dl
rm
Setup.sample
2249
0644
edit
dl
rm
support.py
6478
0644
edit
dl
rm
test_archive_util.py
14301
0644
edit
dl
rm
test_bdist.py
1893
0644
edit
dl
rm
test_bdist_dumb.py
2905
0644
edit
dl
rm
test_bdist_msi.py
803
0644
edit
dl
rm
test_bdist_rpm.py
5008
0644
edit
dl
rm
test_bdist_wininst.py
1390
0644
edit
dl
rm
test_build.py
1965
0644
edit
dl
rm
test_build_clib.py
4631
0644
edit
dl
rm
test_build_ext.py
20633
0644
edit
dl
rm
test_build_py.py
6335
0644
edit
dl
rm
test_build_scripts.py
3593
0644
edit
dl
rm
test_check.py
5711
0644
edit
dl
rm
test_clean.py
1441
0644
edit
dl
rm
test_cmd.py
3835
0644
edit
dl
rm
test_config.py
3892
0644
edit
dl
rm
test_config_cmd.py
3023
0644
edit
dl
rm
test_core.py
4077
0644
edit
dl
rm
test_cygwinccompiler.py
5636
0644
edit
dl
rm
test_dep_util.py
2820
0644
edit
dl
rm
test_dir_util.py
4654
0644
edit
dl
rm
test_dist.py
19080
0644
edit
dl
rm
test_extension.py
2768
0644
edit
dl
rm
test_filelist.py
11475
0644
edit
dl
rm
test_file_util.py
4413
0644
edit
dl
rm
test_install.py
8612
0644
edit
dl
rm
test_install_data.py
2577
0644
edit
dl
rm
test_install_headers.py
1238
0644
edit
dl
rm
test_install_lib.py
3974
0644
edit
dl
rm
test_install_scripts.py
2625
0644
edit
dl
rm
test_log.py
1864
0644
edit
dl
rm
test_msvc9compiler.py
6038
0644
edit
dl
rm
test_msvccompiler.py
2845
0644
edit
dl
rm
test_register.py
9765
0644
edit
dl
rm
test_sdist.py
17047
0644
edit
dl
rm
test_spawn.py
5460
0644
edit
dl
rm
test_sysconfig.py
11045
0644
edit
dl
rm
test_text_file.py
3436
0644
edit
dl
rm
test_unixccompiler.py
4628
0644
edit
dl
rm
test_upload.py
7137
0644
edit
dl
rm
test_util.py
11572
0644
edit
dl
rm
test_version.py
3450
0644
edit
dl
rm
test_versionpredicate.py
280
0644
edit
dl
rm
xxmodule.c
12915
0644
edit
dl
rm
__init__.py
1344
0644
edit
dl
rm
Edit:
/opt/imh-python/lib/python3.9/distutils/tests/test_config.py
(3892B)
"""Tests for distutils.pypirc.pypirc.""" import os import unittest from distutils.core import PyPIRCCommand from distutils.core import Distribution from distutils.log import set_threshold from distutils.log import WARN from distutils.tests import support from test.support import run_unittest PYPIRC = """\ [distutils] index-servers = server1 server2 server3 [server1] username:me password:secret [server2] username:meagain password: secret realm:acme repository:http://another.pypi/ [server3] username:cbiggles password:yh^%#rest-of-my-password """ PYPIRC_OLD = """\ [server-login] username:tarek password:secret """ WANTED = """\ [distutils] index-servers = pypi [pypi] username:tarek password:xxx """ class BasePyPIRCCommandTestCase(support.TempdirManager, support.LoggingSilencer, support.EnvironGuard, unittest.TestCase): def setUp(self): """Patches the environment.""" super(BasePyPIRCCommandTestCase, self).setUp() self.tmp_dir = self.mkdtemp() os.environ['HOME'] = self.tmp_dir os.environ['USERPROFILE'] = self.tmp_dir self.rc = os.path.join(self.tmp_dir, '.pypirc') self.dist = Distribution() class command(PyPIRCCommand): def __init__(self, dist): PyPIRCCommand.__init__(self, dist) def initialize_options(self): pass finalize_options = initialize_options self._cmd = command self.old_threshold = set_threshold(WARN) def tearDown(self): """Removes the patch.""" set_threshold(self.old_threshold) super(BasePyPIRCCommandTestCase, self).tearDown() class PyPIRCCommandTestCase(BasePyPIRCCommandTestCase): def test_server_registration(self): # This test makes sure PyPIRCCommand knows how to: # 1. handle several sections in .pypirc # 2. handle the old format # new format self.write_file(self.rc, PYPIRC) cmd = self._cmd(self.dist) config = cmd._read_pypirc() config = list(sorted(config.items())) waited = [('password', 'secret'), ('realm', 'pypi'), ('repository', 'https://upload.pypi.org/legacy/'), ('server', 'server1'), ('username', 'me')] self.assertEqual(config, waited) # old format self.write_file(self.rc, PYPIRC_OLD) config = cmd._read_pypirc() config = list(sorted(config.items())) waited = [('password', 'secret'), ('realm', 'pypi'), ('repository', 'https://upload.pypi.org/legacy/'), ('server', 'server-login'), ('username', 'tarek')] self.assertEqual(config, waited) def test_server_empty_registration(self): cmd = self._cmd(self.dist) rc = cmd._get_rc_file() self.assertFalse(os.path.exists(rc)) cmd._store_pypirc('tarek', 'xxx') self.assertTrue(os.path.exists(rc)) f = open(rc) try: content = f.read() self.assertEqual(content, WANTED) finally: f.close() def test_config_interpolation(self): # using the % character in .pypirc should not raise an error (#20120) self.write_file(self.rc, PYPIRC) cmd = self._cmd(self.dist) cmd.repository = 'server3' config = cmd._read_pypirc() config = list(sorted(config.items())) waited = [('password', 'yh^%#rest-of-my-password'), ('realm', 'pypi'), ('repository', 'https://upload.pypi.org/legacy/'), ('server', 'server3'), ('username', 'cbiggles')] self.assertEqual(config, waited) def test_suite(): return unittest.makeSuite(PyPIRCCommandTestCase) if __name__ == "__main__": run_unittest(test_suite())
Save
cmd:
run