• 
      

    Copy perforce repo data for unit tests.

    Review Request #14609 — Created Sept. 11, 2025 and submitted

    Information

    Review Board
    release-7.x

    Reviewers

    The new unit tests that use a local p4d had an issue where the db.user
    file got updated (likely with a login timestamp) when running the tests.
    In order to prevent this file from getting updated every time we run
    tests, we now make a copy of the repo data for the duration of the test
    suite.

    Ran test_perforce.py tests and saw that db.user was no longer modified
    in my local checkout.

    Summary ID
    Copy perforce repo data for unit tests.
    The new unit tests that use a local p4d had an issue where the db.user file got updated (likely with a login timestamp) when running the tests. In order to prevent this file from getting updated every time we run tests, we now make a copy of the repo data for the duration of the test suite. Testing Done: Ran test_perforce.py tests and saw that db.user was no longer modified in my local checkout.
    mwkkzzsqsqttsvqstnzosqnozpxzuuxm
    Description From Last Updated

    'shutil.copytree' imported but unused Column: 1 Error code: F401

    reviewbotreviewbot

    Thinking we should probably do a try/finally and put the rmtree in the finally, so it doesn't end up leaving …

    chipx86chipx86
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    david
    chipx86
    1. 
        
    2. reviewboard/scmtools/tests/test_perforce.py (Diff revision 2)
       
       
       
       
       
      Show all issues

      Thinking we should probably do a try/finally and put the rmtree in the finally, so it doesn't end up leaving files around. Though I guess the question is then, if the process does not terminate, do we want to delete the files...

    3. 
        
    david
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-7.x (f1ec80a)