summaryrefslogtreecommitdiff
path: root/distutils2/tests/test_command_upload.py
diff options
context:
space:
mode:
author?ric Araujo <merwok@netwok.org>2011-09-18 20:23:12 +0200
committer?ric Araujo <merwok@netwok.org>2011-09-18 20:23:12 +0200
commit0555ed6a05c59e22963c0c1d931f7fcfa284f04f (patch)
tree72f75948015b56a345b0d4fa41ef48a398fe1271 /distutils2/tests/test_command_upload.py
parent506cfea8bbd41e865bc36a836bdbc05aae8d74bb (diff)
downloaddisutils2-0555ed6a05c59e22963c0c1d931f7fcfa284f04f.tar.gz
Fix backport changesets part 2: tests
Diffstat (limited to 'distutils2/tests/test_command_upload.py')
-rw-r--r--distutils2/tests/test_command_upload.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/distutils2/tests/test_command_upload.py b/distutils2/tests/test_command_upload.py
index cc8cb05..76281ca 100644
--- a/distutils2/tests/test_command_upload.py
+++ b/distutils2/tests/test_command_upload.py
@@ -1,3 +1,4 @@
+# encoding: utf-8
"""Tests for distutils2.command.upload."""
import os
@@ -101,22 +102,23 @@ class UploadTestCase(support.TempdirManager, support.EnvironRestorer,
command, pyversion, filename = 'xxx', '3.3', path
dist_files = [(command, pyversion, filename)]
- # lets run it
- pkg_dir, dist = self.create_dist(dist_files=dist_files, author='d\xc3d\xc3')
+ # let's run it
+ dist = self.create_dist(dist_files=dist_files, author='dédé')[1]
cmd = upload(dist)
cmd.ensure_finalized()
cmd.repository = self.pypi.full_address
cmd.run()
- # what did we send ?
+ # what did we send?
handler, request_data = self.pypi.requests[-1]
headers = handler.headers
- #self.assertIn('d\xc3d\xc3', str(request_data))
+ self.assertIn('dédé', request_data)
self.assertIn('xxx', request_data)
self.assertEqual(int(headers['content-length']), len(request_data))
self.assertLess(int(headers['content-length']), 2500)
- self.assertTrue(headers['content-type'].startswith('multipart/form-data'))
+ self.assertTrue(headers['content-type'].startswith(
+ 'multipart/form-data'))
self.assertEqual(handler.command, 'POST')
self.assertNotIn('\n', headers['authorization'])
@@ -130,20 +132,16 @@ class UploadTestCase(support.TempdirManager, support.EnvironRestorer,
self.write_file(os.path.join(docs_path, "index.html"), "yellow")
self.write_file(self.rc, PYPIRC)
- # lets run it
- pkg_dir, dist = self.create_dist(dist_files=dist_files, author='d\xc3d\xc3')
+ # let's run it
+ dist = self.create_dist(dist_files=dist_files, author='dédé')[1]
cmd = upload(dist)
cmd.get_finalized_command("build").run()
cmd.upload_docs = True
cmd.ensure_finalized()
cmd.repository = self.pypi.full_address
- prev_dir = os.getcwd()
- try:
- os.chdir(self.tmp_dir)
- cmd.run()
- finally:
- os.chdir(prev_dir)
+ os.chdir(self.tmp_dir)
+ cmd.run()
handler, request_data = self.pypi.requests[-1]
action, name, content = request_data.split(
@@ -156,6 +154,8 @@ class UploadTestCase(support.TempdirManager, support.EnvironRestorer,
UploadTestCase = unittest.skipIf(threading is None, 'needs threading')(
UploadTestCase)
+
+
def test_suite():
return unittest.makeSuite(UploadTestCase)