Combinator tests fail unless code is in correct directory

Bug #1025376 reported by Jonathan Lange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Divmod
New
Undecided
Unassigned

Bug Description

Running the combinator tests (or indeed combinator itself) when the code doesn't live in a directory named Divmod/trunk/Combinator will raise errors.

It warns, explaining that the error can be avoided by passing --projects-dir. I didn't try that. Setting COMBINATOR_PROJECTS worked for me.

The problem was that the stack trace distracted me from the warning, so I looked at the code to figure it out.

Here's the errors:

 $ bzr branch lp:divmod.org
 $ cd divmod.org/Combinator
 $ trial combinator
 /home/jml/src/divmod.org/Combinator/combinator/branchmgr.py:86: UserWarning: Combinator sitecustomize located outside of Combinator directory, aborting (try passing --projects-dir)
   warnings.warn(*a, **k)
 combinator
   test
     test_branchmgr ... [ERROR]
 combinator.test.test_subversion
   CreateSubversionRepositoryTests
     test_commit ... [OK]
     test_directory ... [OK]
     test_directoryContainingFile ... [OK]
     test_emptyFile ... [OK]
     test_emptyRepository ... [OK]
     test_fileWithContents ... [OK]
     test_workingCopyRemoved ... [OK]
 combinator.test.test_sysenv
   EnvironmentInteractionTest
     test_combinatorEnvironment ... [ERROR]
 /home/jml/src/divmod.org/Combinator/combinator/branchmgr.py:86: UserWarning: Combinator sitecustomize located outside of Combinator directory, aborting (try passing --projects-dir)
     test_executableCreation ... [ERROR]
 /home/jml/src/divmod.org/Combinator/combinator/branchmgr.py:86: UserWarning: Combinator sitecustomize located outside of Combinator directory, aborting (try passing --projects-dir)
   EnvironmentManipulatorTest
     test_noPathReordering ... [OK]
     test_twoVariables ... [OK]
 combinator.test.test_tests
   EnvironmentTestCase
     test_pathsMatch ... [OK]
 combinator.test.test_xsite
   Pth
     test_addSiteDir ... [OK]
     test_extraPthBits ... [OK]
     test_invalidSiteDir ... [OK]

  ===============================================================================
 [ERROR]
 Traceback (most recent call last):
   File "/usr/lib/python2.7/dist-packages/twisted/trial/runner.py", line 572, in loadPackage
     module = modinfo.load()
   File "/usr/lib/python2.7/dist-packages/twisted/python/modules.py", line 383, in load
     return self.pathEntry.pythonPath.moduleLoader(self.name)
   File "/usr/lib/python2.7/dist-packages/twisted/python/reflect.py", line 464, in namedAny
     topLevelPackage = _importAndCheckStack(trialname)
   File "/usr/lib/python2.7/dist-packages/twisted/python/reflect.py", line 400, in _importAndCheckStack
     return __import__(importName)
   File "/home/jml/src/divmod.org/Combinator/combinator/test/test_branchmgr.py", line 11, in <module>
     from combinator import branchmgr
   File "/home/jml/src/divmod.org/Combinator/combinator/branchmgr.py", line 725, in <module>
      theBranchManager = BranchManager()
   File "/home/jml/src/divmod.org/Combinator/combinator/branchmgr.py", line 312, in __init__
     os.path.join(svnProjectsDir, "combinator_paths"))
   File "/usr/lib/python2.7/posixpath.py", line 68, in join
     elif path == '' or path.endswith('/'):
 exceptions.AttributeError: 'NoneType' object has no attribute 'endswith'

 combinator.test.test_branchmgr
 ===============================================================================
 [ERROR]
 Traceback (most recent call last):
   File "/home/jml/src/divmod.org/Combinator/combinator/test/test_sysenv.py", line 75, in test_combinatorEnvironment
     generatePathVariable(e, "alpha", "beta", StringIO())
   File "/home/jml/src/divmod.org/Combinator/combinator/sysenv.py", line 150, in generatePathVariable
     from combinator import branchmgr
   File "/home/jml/src/divmod.org/Combinator/combinator/branchmgr.py", line 725, in <module>
     theBranchManager = BranchManager()
   File "/home/jml/src/divmod.org/Combinator/combinator/branchmgr.py", line 312, in __init__
     os.path.join(svnProjectsDir, "combinator_paths"))
   File "/usr/lib/python2.7/posixpath.py", line 68, in join
     elif path == '' or path.endswith('/'):
 exceptions.AttributeError: 'NoneType' object has no attribute 'endswith'

 combinator.test.test_sysenv.EnvironmentInteractionTest.test_combinatorEnvironment
 ===============================================================================
 [ERROR]
 Traceback (most recent call last):
   File "/home/jml/src/divmod.org/Combinator/combinator/test/test_sysenv.py", line 96, in test_executableCreation
     m = generatePathVariable(e, alpha, beta, StringIO())
   File "/home/jml/src/divmod.org/Combinator/combinator/sysenv.py", line 150, in generatePathVariable
     from combinator import branchmgr
   File "/home/jml/src/divmod.org/Combinator/combinator/branchmgr.py", line 725, in <module>
     theBranchManager = BranchManager()
   File "/home/jml/src/divmod.org/Combinator/combinator/branchmgr.py", line 312, in __init__
     os.path.join(svnProjectsDir, "combinator_paths"))
   File "/usr/lib/python2.7/posixpath.py", line 68, in join
     elif path == '' or path.endswith('/'):
 exceptions.AttributeError: 'NoneType' object has no attribute 'endswith'

 combinator.test.test_sysenv.EnvironmentInteractionTest.test_executableCreation
 -------------------------------------------------------------------------------

Also, and I think the same root cause:

 $ bzr branch lp:divmod.org
 $ python divmod.org/Combinator/environment.py
  /home/jml/src/divmod.org/Combinator/combinator/branchmgr.py:86: UserWarning: Combinator sitecustomize located outside of Combinator directory, aborting (try passing --projects-dir)
    warnings.warn(*a, **k)
  Traceback (most recent call last):
    File "environment.py", line 2, in <module>
      run()
    File "/home/jml/src/divmod.org/Combinator/combinator/scripts/environment.py", line 13, in run
      sysenv.export(options.projects_dir, options.paths_dir)
    File "/home/jml/src/divmod.org/Combinator/combinator/sysenv.py", line 192, in export
      m = generatePathVariable(e, svnProjectsDir, sitePathsPath)
    File "/home/jml/src/divmod.org/Combinator/combinator/sysenv.py", line 150, in generatePathVariable
      from combinator import branchmgr
    File "/home/jml/src/divmod.org/Combinator/combinator/branchmgr.py", line 725, in <module>
      theBranchManager = BranchManager()
    File "/home/jml/src/divmod.org/Combinator/combinator/branchmgr.py", line 312, in __init__
      os.path.join(svnProjectsDir, "combinator_paths"))
    File "/usr/lib/python2.7/posixpath.py", line 68, in join
      elif path == '' or path.endswith('/'):
  AttributeError: 'NoneType' object has no attribute 'endswith'

I tried to patch this, but I struggled to figure out how to write a test that would reproduce the problem regardless of directory.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.