django icon indicating copy to clipboard operation
django copied to clipboard

Fixed #23251 -- Uses a temporary folder for media upload when running tests

Open bhavya-tech opened this issue 1 year ago • 3 comments

Made nature of media uploads in tests same as database.

If TEST_MEDIA_ROOT is defined in the settings:

  • Running the test suit will create a new folder using TEST_MEDIA_ROOT, if any file is uploaded.
  • During teardown of the test environment, the folder is deleted.
  • Using the --keep-media flag will prevent deletion of the test folder.

If TEST_MEDIA_ROOT is not defined in the settings, then it will follow the default behaviour of using MEDIA_ROOT as earlier (for maintaining reverse compatibility).

bhavya-tech avatar Jul 15 '22 13:07 bhavya-tech

Hello @bhavya-tech! Thank you for your contribution 💪

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

github-actions[bot] avatar Jul 15 '22 13:07 github-actions[bot]

@shaib Do you want to take a look?

felixxm avatar Jul 16 '22 13:07 felixxm

Waiting on Fixed #26029 -- Added STORAGES setting PR to get merged to proceed.

bhavya-tech avatar Jul 18 '22 05:07 bhavya-tech