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

tests.getTempFilePath should remove any existing file

    Details

    • Type: Story
    • Status: To Do
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: utils
    • Labels:

      Description

      An unrelated previous test failure that leaves the old file around can cause problems if the block inside this context manager appends to the previous file if it already exists.

      I'm also not certain if the context manager is supposed to be letting the file stick around when the test fails, but that is what I'm seeing (with the file in question a sqlite3 database).

        Attachments

          Issue Links

            Activity

            Hide
            swinbank John Swinbank added a comment -

            I'm also not certain if the context manager is supposed to be letting the file stick around when the test fails

            The docstring says if the block exits with an exception the file if left on disk so it can be examined, which I guess is what you're seeing.

            Suggest that we should add a timestamp to the filename to work around this problem.

            Show
            swinbank John Swinbank added a comment - I'm also not certain if the context manager is supposed to be letting the file stick around when the test fails The docstring says if the block exits with an exception the file if left on disk so it can be examined , which I guess is what you're seeing. Suggest that we should add a timestamp to the filename to work around this problem.
            Hide
            price Paul Price added a comment -

            I think we very much want the file to be left on disk in the event of an exception (and it would be helpful to have a parameter controlling whether it's deleted).

            I suggest that what Jim Bosch wants is to have the context manager delete the file (if it exists) in the __enter__ (before the yield).

            Show
            price Paul Price added a comment - I think we very much want the file to be left on disk in the event of an exception (and it would be helpful to have a parameter controlling whether it's deleted). I suggest that what Jim Bosch wants is to have the context manager delete the file (if it exists) in the __enter__ (before the yield ).
            Hide
            tjenness Tim Jenness added a comment -

            Paul Price suggests that this work be combined with the request in DM-11635.

            Show
            tjenness Tim Jenness added a comment - Paul Price suggests that this work be combined with the request in DM-11635 .
            Hide
            tjenness Tim Jenness added a comment -

            DM-13046 has made this moot now that file names are randomized, although I have put an explicit check and warning in as part of DM-11635. Closing this as invalid.

            Show
            tjenness Tim Jenness added a comment - DM-13046 has made this moot now that file names are randomized, although I have put an explicit check and warning in as part of DM-11635 . Closing this as invalid.
            Hide
            tjenness Tim Jenness added a comment -

            Actually, I see it's in an epic for DRP, John Swinbank what do you want to do?

            Show
            tjenness Tim Jenness added a comment - Actually, I see it's in an epic for DRP, John Swinbank what do you want to do?
            Hide
            tjenness Tim Jenness added a comment -

            I did this fix in DM-11635.

            Show
            tjenness Tim Jenness added a comment - I did this fix in DM-11635 .

              People

              • Assignee:
                Unassigned
                Reporter:
                jbosch Jim Bosch
                Watchers:
                Jim Bosch, John Swinbank, Paul Price, Tim Jenness
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Summary Panel