From 5828d8f7ca167b11296733a2b54f9d6fca29b7b0 Mon Sep 17 00:00:00 2001 From: Rick van Hattem Date: Wed, 29 Apr 2020 12:20:02 +0200 Subject: [PATCH] Changed hardcoded /tmp/ directory to autodetect from system (#7292) --- tests/test_model_serializer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_model_serializer.py b/tests/test_model_serializer.py index fbb562792..0de628dc8 100644 --- a/tests/test_model_serializer.py +++ b/tests/test_model_serializer.py @@ -8,6 +8,7 @@ an appropriate set of serializer fields for each case. import datetime import decimal import sys +import tempfile from collections import OrderedDict import django @@ -71,7 +72,7 @@ class RegularFieldsModel(models.Model): time_field = models.TimeField() url_field = models.URLField(max_length=100) custom_field = CustomField() - file_path_field = models.FilePathField(path='/tmp/') + file_path_field = models.FilePathField(path=tempfile.gettempdir()) def method(self): return 'method' @@ -191,8 +192,8 @@ class TestRegularFieldMappings(TestCase): time_field = TimeField() url_field = URLField(max_length=100) custom_field = ModelField(model_field=) - file_path_field = FilePathField(path='/tmp/') - """) + file_path_field = FilePathField(path=%r) + """ % tempfile.gettempdir()) self.assertEqual(repr(TestSerializer()), expected)