Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-7157

Test order in daf_persistence can cause some tests to skip

    Details

    • Type: Bug
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: daf_persistence
    • Labels:

      Description

      If all tests are run from py.test as:

      py.test tests/*.py
      

      The DbStorage_?.py tests skip. If they are run without DbAuth.py running they run and pass. Something in DbAuth.py is causing the availability test to fail.

        Attachments

          Issue Links

            Activity

            Hide
            npease Nate Pease added a comment -

            the DbStorage tests appear to be running fine now, without any changes. I did find one other issue with pytest, where an imported class called TestObject caused the test list generation to fail, so I fixed that.

            Current output from pytest looks like this:

            n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence[tickets/DM-7157]$ py.test tests/*.py
            ============================================================================================== test session starts ==============================================================================================
            platform darwin – Python 2.7.12, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
            rootdir: /Users/n8pease/2/lsstsw/build/daf_persistence, inifile:
            collected 120 items

            tests/DbAuth.py ...
            tests/DbStorage_1.py s..
            tests/DbStorage_2.py s..
            tests/LogicalLocation.py ...
            tests/Persistence_1.py ...
            tests/Persistence_2.py sss..
            tests/butlerAlias.py ...........
            tests/butlerPickle.py ....
            tests/butlerSubset.py .......
            tests/dataId.py ......
            tests/mapper.py .......
            tests/mapperImport.py .....
            tests/repoFindByDate.py x..
            tests/reposInButler.py x..
            tests/repository.py .................
            tests/repositoryArgs.py .....
            tests/repositoryCfg.py .....
            tests/safeFileIo.py ....
            tests/testFsScanner.py ....
            tests/testPolicy.py ................
            tests/testRegistry.py ...

            =============================================================================== 113 passed, 5 skipped, 2 xfailed in 3.53 seconds ================================================================================
            n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence[tickets/DM-7157]$

            Show
            npease Nate Pease added a comment - the DbStorage tests appear to be running fine now, without any changes. I did find one other issue with pytest, where an imported class called TestObject caused the test list generation to fail, so I fixed that. Current output from pytest looks like this: n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence [tickets/DM-7157] $ py.test tests/*.py ============================================================================================== test session starts ============================================================================================== platform darwin – Python 2.7.12, pytest-3.0.3, py-1.4.31, pluggy-0.4.0 rootdir: /Users/n8pease/2/lsstsw/build/daf_persistence, inifile: collected 120 items tests/DbAuth.py ... tests/DbStorage_1.py s.. tests/DbStorage_2.py s.. tests/LogicalLocation.py ... tests/Persistence_1.py ... tests/Persistence_2.py sss.. tests/butlerAlias.py ........... tests/butlerPickle.py .... tests/butlerSubset.py ....... tests/dataId.py ...... tests/mapper.py ....... tests/mapperImport.py ..... tests/repoFindByDate.py x.. tests/reposInButler.py x.. tests/repository.py ................. tests/repositoryArgs.py ..... tests/repositoryCfg.py ..... tests/safeFileIo.py .... tests/testFsScanner.py .... tests/testPolicy.py ................ tests/testRegistry.py ... =============================================================================== 113 passed, 5 skipped, 2 xfailed in 3.53 seconds ================================================================================ n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence [tickets/DM-7157] $
            Hide
            npease Nate Pease added a comment -

            Brian, can you take a look this? The changes are pretty minimal. (thanks!)

            Show
            npease Nate Pease added a comment - Brian, can you take a look this? The changes are pretty minimal. (thanks!)
            Hide
            tjenness Tim Jenness added a comment -

            Nate Pease I don't think you are understanding the problem at hand. Let me be more explicit:

            $ py.test tests/DbStorage_1.py 
            ============================= test session starts ==============================
            platform darwin -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
            rootdir: /Users/timj/work/lsstsw/src/daf_persistence/tests, inifile: 
            plugins: cov-2.2.1, xdist-1.14
            collected 3 items 
             
            tests/DbStorage_1.py ...
             
            =========================== 3 passed in 2.15 seconds ===========================
            thrylos:daf_persistence (master) $ py.test tests/DbAuth.py tests/DbStorage_1.py 
            =================================================== test session starts ====================================================
            platform darwin -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
            rootdir: /Users/timj/work/lsstsw/src/daf_persistence/tests, inifile: 
            plugins: cov-2.2.1, xdist-1.14
            collected 6 items 
             
            tests/DbAuth.py ...
            tests/DbStorage_1.py s..
             
            =========================================== 5 passed, 1 skipped in 1.15 seconds ============================================
            

            If I run the test on its own it passes. If I run DbAuth.py test first the first test in the next test file skips (which is what you show above). Something in DbAuth.py is messing up DbStorage_1.py.

            Show
            tjenness Tim Jenness added a comment - Nate Pease I don't think you are understanding the problem at hand. Let me be more explicit: $ py.test tests/DbStorage_1.py ============================= test session starts ============================== platform darwin -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 rootdir: /Users/timj/work/lsstsw/src/daf_persistence/tests, inifile: plugins: cov-2.2.1, xdist-1.14 collected 3 items   tests/DbStorage_1.py ...   =========================== 3 passed in 2.15 seconds =========================== thrylos:daf_persistence (master) $ py.test tests/DbAuth.py tests/DbStorage_1.py =================================================== test session starts ==================================================== platform darwin -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 rootdir: /Users/timj/work/lsstsw/src/daf_persistence/tests, inifile: plugins: cov-2.2.1, xdist-1.14 collected 6 items   tests/DbAuth.py ... tests/DbStorage_1.py s..   =========================================== 5 passed, 1 skipped in 1.15 seconds ============================================ If I run the test on its own it passes. If I run DbAuth.py test first the first test in the next test file skips (which is what you show above). Something in DbAuth.py is messing up DbStorage_1.py .
            Hide
            tjenness Tim Jenness added a comment -

            Also see:

            $ py.test tests/Persistence_2.py 
            =================================================== test session starts ====================================================
            platform darwin -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
            rootdir: /Users/timj/work/lsstsw/src/daf_persistence/tests, inifile: 
            plugins: cov-2.2.1, xdist-1.14
            collected 5 items 
             
            tests/Persistence_2.py .....
             
            ================================================= 5 passed in 4.45 seconds =================================================
            thrylos:daf_persistence (master) $ py.test tests/DbAuth.py tests/Persistence_2.py 
            =================================================== test session starts ====================================================
            platform darwin -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
            rootdir: /Users/timj/work/lsstsw/src/daf_persistence/tests, inifile: 
            plugins: cov-2.2.1, xdist-1.14
            collected 8 items 
             
            tests/DbAuth.py ...
            tests/Persistence_2.py sss..
             
            =========================================== 5 passed, 3 skipped in 1.06 seconds ============================================
            

            So Persistence_2.py is also skipping when it should not.

            Show
            tjenness Tim Jenness added a comment - Also see: $ py.test tests/Persistence_2.py =================================================== test session starts ==================================================== platform darwin -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 rootdir: /Users/timj/work/lsstsw/src/daf_persistence/tests, inifile: plugins: cov-2.2.1, xdist-1.14 collected 5 items   tests/Persistence_2.py .....   ================================================= 5 passed in 4.45 seconds ================================================= thrylos:daf_persistence (master) $ py.test tests/DbAuth.py tests/Persistence_2.py =================================================== test session starts ==================================================== platform darwin -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 rootdir: /Users/timj/work/lsstsw/src/daf_persistence/tests, inifile: plugins: cov-2.2.1, xdist-1.14 collected 8 items   tests/DbAuth.py ... tests/Persistence_2.py sss..   =========================================== 5 passed, 3 skipped in 1.06 seconds ============================================ So Persistence_2.py is also skipping when it should not.
            Hide
            npease Nate Pease added a comment -

            new outputs:

            n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence[tickets/DM-7157*]$ py.test tests/DbAuth.py  tests/DbStorage_1.py 
            ==================================================================== test session starts =====================================================================
            platform darwin -- Python 2.7.12, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
            rootdir: /Users/n8pease/2/lsstsw/build/daf_persistence, inifile: 
            collected 6 items 
             
            tests/DbAuth.py ...
            tests/DbStorage_1.py ...
             
            ================================================================== 6 passed in 2.32 seconds ==================================================================
            n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence[tickets/DM-7157*]$ py.test tests/DbAuth.py  tests/Persistence_2.py 
            ==================================================================== test session starts =====================================================================
            platform darwin -- Python 2.7.12, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
            rootdir: /Users/n8pease/2/lsstsw/build/daf_persistence, inifile: 
            collected 8 items 
             
            tests/DbAuth.py ...
            tests/Persistence_2.py .....
             
            ================================================================== 8 passed in 3.04 seconds ==================================================================
            n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence[tickets/DM-7157*]$ 
            

            (checking in now...)

            Show
            npease Nate Pease added a comment - new outputs: n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence[tickets/DM-7157*]$ py.test tests/DbAuth.py tests/DbStorage_1.py ==================================================================== test session starts ===================================================================== platform darwin -- Python 2.7.12, pytest-3.0.3, py-1.4.31, pluggy-0.4.0 rootdir: /Users/n8pease/2/lsstsw/build/daf_persistence, inifile: collected 6 items   tests/DbAuth.py ... tests/DbStorage_1.py ...   ================================================================== 6 passed in 2.32 seconds ================================================================== n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence[tickets/DM-7157*]$ py.test tests/DbAuth.py tests/Persistence_2.py ==================================================================== test session starts ===================================================================== platform darwin -- Python 2.7.12, pytest-3.0.3, py-1.4.31, pluggy-0.4.0 rootdir: /Users/n8pease/2/lsstsw/build/daf_persistence, inifile: collected 8 items   tests/DbAuth.py ... tests/Persistence_2.py .....   ================================================================== 8 passed in 3.04 seconds ================================================================== n8pease@Nates-MacBook-Pro ~/2/lsstsw/build/daf_persistence[tickets/DM-7157*]$ (checking in now...)
            Hide
            tjenness Tim Jenness added a comment -

            Looks good. Thanks. An explicit method to clear the policy is better than the (incomplete) hack of setting the policy to a new blank Policy().

            Show
            tjenness Tim Jenness added a comment - Looks good. Thanks. An explicit method to clear the policy is better than the (incomplete) hack of setting the policy to a new blank Policy() .
            Hide
            npease Nate Pease added a comment -

            Tim Jenness FWIW setting an empty policy (via Policy()) does not work because the impl looks for a null pointer, not an empty policy (and so resetPolicy() sets the ptr to null)

            Show
            npease Nate Pease added a comment - Tim Jenness FWIW setting an empty policy (via Policy() ) does not work because the impl looks for a null pointer, not an empty policy (and so resetPolicy() sets the ptr to null)

              People

              • Assignee:
                npease Nate Pease
                Reporter:
                tjenness Tim Jenness
                Reviewers:
                Tim Jenness
                Watchers:
                Brian Van Klaveren, Nate Pease, Tim Jenness
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel