← Back to team overview

divmod-dev team mailing list archive

[Bug 1025376] [NEW] Combinator tests fail unless code is in correct directory

 

Public bug reported:

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.

** Affects: divmod.org
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Divmod-
dev, which is the registrant for Divmod.
https://bugs.launchpad.net/bugs/1025376

Title:
  Combinator tests fail unless code is in correct directory

Status in The Legacy of Divmod:
  New

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 manage notifications about this bug go to:
https://bugs.launchpad.net/divmod.org/+bug/1025376/+subscriptions


Follow ups

References