Skip to content

Commit

Permalink
TestMixin: don't install ".gitkeep" files.
Browse files Browse the repository at this point in the history
Files called ".gitkeep" are used as placeholders to tell git to create
the directory.  They shouldn't be copied as part of the demo project
content (in fact, a file called ".gitkeep" would not be allowed by the
file upload form.)

For example, the demo active project AGlSZa5VTv5Dg09CSpoh contains no
actual files, but the git repository includes the file
demo-files/media/active-projects/AGlSZa5VTv5Dg09CSpoh/.gitkeep - so in
this case, TestMixin should create an empty project directory.
  • Loading branch information
Benjamin Moody committed Sep 25, 2024
1 parent ca56a5c commit 7787c31
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions physionet-django/user/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ def setUp(self):
"""
_force_delete_tree(settings.MEDIA_ROOT)
shutil.copytree(os.path.abspath(os.path.join(settings.DEMO_FILE_ROOT, 'media')),
settings.MEDIA_ROOT)
settings.MEDIA_ROOT,
ignore=shutil.ignore_patterns('.gitkeep'))

self.test_static_root = settings.STATIC_ROOT if settings.STATIC_ROOT else settings.STATICFILES_DIRS[0]
_force_delete_tree(self.test_static_root)
shutil.copytree(os.path.abspath(os.path.join(settings.DEMO_FILE_ROOT, 'static')),
self.test_static_root)
self.test_static_root,
ignore=shutil.ignore_patterns('.gitkeep'))

if os.path.exists(ORIGINAL_DBCAL_FILE):
os.symlink(ORIGINAL_DBCAL_FILE, DBCAL_FILE)
Expand Down

0 comments on commit 7787c31

Please sign in to comment.