Commits

Carl Meyer  committed 55a8f6a

fix logfile with no dirname; fixes #90

  • Participants
  • Parent commits b3229f5

Comments (0)

Files changed (3)

File docs/news.txt

 News for pip
 ============
 
+tip
+---
+
+* Fixed opening of logfile with no directory name. Thanks Alexandre Conrad.
+
 0.7
 ---
 

File pip/basecommand.py

     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)

File tests/test_config.py

 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)
     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)