From cf4861e49551e390d958430b57c9cd02d2e4c8bc Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sat, 17 Apr 2010 23:49:29 +0200 Subject: Add check that after creating scratch venv calling python runs the right python. --- tests/test_pip.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_pip.py b/tests/test_pip.py index a540e1a1a..6525d7b6c 100755 --- a/tests/test_pip.py +++ b/tests/test_pip.py @@ -48,7 +48,14 @@ def reset_env(environ=None): # put the test-scratch virtualenv's bin dir first on the script path env.script_path.insert(0, virtualenv_bin_dir(env.base_path)) - + + # test that test-scratch virtualenv creation produced sensible venv python + result = env.run('python', '-c', 'import sys; print sys.executable') + pythonbin = result.stdout.strip() + if pythonbin != os.path.join(virtualenv_bin_dir(env.base_path), "python"): + raise RuntimeError("Python sys.executable (%r) isn't the " + "test-scratch venv python" % pythonbin) + # make sure we have current setuptools to avoid svn incompatibilities env.run('easy_install', 'setuptools==0.6c11') -- cgit v1.2.1 From 90c027cf233d26d70210e1bca84b5f2fa90bc2d9 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Mon, 19 Apr 2010 07:51:15 -0400 Subject: fix logfile with no dirname; fixes #90 --- docs/news.txt | 5 +++++ pip/basecommand.py | 1 + tests/test_config.py | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/docs/news.txt b/docs/news.txt index 6d9ee865a..a272a361c 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -1,6 +1,11 @@ News for pip ============ +tip +--- + +* Fixed opening of logfile with no directory name. Thanks Alexandre Conrad. + 0.7 --- diff --git a/pip/basecommand.py b/pip/basecommand.py index a227f1c50..530b1d7ef 100644 --- a/pip/basecommand.py +++ b/pip/basecommand.py @@ -188,6 +188,7 @@ def open_logfile(filename, mode='a'): the file to separate past activity from current activity. """ filename = os.path.expanduser(filename) + filename = os.path.abspath(filename) dirname = os.path.dirname(filename) if not os.path.exists(dirname): os.makedirs(dirname) diff --git a/tests/test_config.py b/tests/test_config.py index b3af6c2b6..16079ae58 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -4,6 +4,8 @@ import textwrap from test_pip import here, reset_env, run_pip, clear_environ, write_file import os +from pip.basecommand import open_logfile + def test_options_from_env_vars(): """ Test if ConfigOptionParser reads env vars (e.g. not using PyPI here) @@ -76,3 +78,13 @@ def test_config_file_override_stack(): assert "Getting page http://pypi.appspot.com/INITools" not in result.stdout assert "Getting page http://pypi.python.org/simple/INITools" in result.stdout +def test_log_file_no_directory(): + """ + Test opening a log file with no directory name. + + """ + fp = open_logfile('testpip.log') + fp.write('can write') + fp.close() + assert os.path.exists(fp.name) + os.remove(fp.name) -- cgit v1.2.1 From c36a968fb4aacc5d19cd19fce234968f50371d11 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Mon, 19 Apr 2010 08:43:29 -0400 Subject: update test runner to work with ScriptTest 1.0.2 (no _find_exe) --- tests/test_pip.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_pip.py b/tests/test_pip.py index 6525d7b6c..1f9cc137a 100755 --- a/tests/test_pip.py +++ b/tests/test_pip.py @@ -42,13 +42,12 @@ def reset_env(environ=None): environ['PIP_DOWNLOAD_CACHE'] = download_cache environ['PIP_NO_INPUT'] = '1' environ['PIP_LOG_FILE'] = os.path.join(base_path, 'pip-log.txt') + # put the test-scratch virtualenv's bin dir first on the script path + environ['PATH'] = "%s%s%s" % (virtualenv_bin_dir(base_path), os.pathsep, environ['PATH']) env = TestFileEnvironment(base_path, ignore_hidden=False, environ=environ) env.run(sys.executable, '-m', 'virtualenv', '--no-site-packages', env.base_path) - # put the test-scratch virtualenv's bin dir first on the script path - env.script_path.insert(0, virtualenv_bin_dir(env.base_path)) - # test that test-scratch virtualenv creation produced sensible venv python result = env.run('python', '-c', 'import sys; print sys.executable') pythonbin = result.stdout.strip() -- cgit v1.2.1 From 20026fc6953fd76ed31cec8eddaf648fc0bcdefa Mon Sep 17 00:00:00 2001 From: Ian Bicking Date: Tue, 20 Apr 2010 12:15:04 -0500 Subject: new place to publish docs to --- regen-docs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/regen-docs b/regen-docs index c08709dad..55dbb855c 100755 --- a/regen-docs +++ b/regen-docs @@ -9,7 +9,8 @@ fi mkdir -p docs/_static docs/_build sphinx-build -E -b html docs/ docs/_build || exit 1 if [ "$CMD" = "publish" ] ; then - cd docs/_build + cd docs/ echo "Uploading files..." - tar czvf - . | ssh flow.openplans.org 'ssh acura.openplans.org "cd /www/pip.openplans.org/htdocs/; tar xzvf -"' + scp -r _build/ root@cloudsilverlining.org:/var/lib/silverlining/writable-roots/bbdocs/pip.openplans.org/ + ssh root@cloudsilverlining.org 'chown -R www-data:www-data /var/lib/silverlining/writable-roots/bbdocs/' fi -- cgit v1.2.1 From ba464787e88990a4533e24e05263883b6fc8e5a6 Mon Sep 17 00:00:00 2001 From: Ian Bicking Date: Thu, 22 Apr 2010 01:37:50 -0500 Subject: update tests to check temp files --- tests/test_pip.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_pip.py b/tests/test_pip.py index 1f9cc137a..e4efe84ef 100755 --- a/tests/test_pip.py +++ b/tests/test_pip.py @@ -45,7 +45,8 @@ def reset_env(environ=None): # put the test-scratch virtualenv's bin dir first on the script path environ['PATH'] = "%s%s%s" % (virtualenv_bin_dir(base_path), os.pathsep, environ['PATH']) - env = TestFileEnvironment(base_path, ignore_hidden=False, environ=environ) + env = TestFileEnvironment(base_path, ignore_hidden=False, environ=environ, + capture_temp=True, assert_no_temp=True) env.run(sys.executable, '-m', 'virtualenv', '--no-site-packages', env.base_path) # test that test-scratch virtualenv creation produced sensible venv python @@ -106,7 +107,7 @@ def diff_states(start, end, ignore=None): Ignores mtime and other file attributes; only presence/absence and size are considered. - + """ ignore = ignore or [] start_keys = set([k for k in start.keys() @@ -124,4 +125,3 @@ def diff_states(start, end, ignore=None): if __name__ == '__main__': sys.stderr.write("Run pip's tests using nosetests. Requires virtualenv, ScriptTest, and nose.\n") sys.exit(1) - -- cgit v1.2.1