From a19c8b0d5e4fc31b5c4c2c04e0e30a9d128d31be Mon Sep 17 00:00:00 2001 From: Rick van Hattem Date: Sat, 25 Apr 2020 18:11:01 +0200 Subject: [PATCH] Changed hardcoded /tmp/ directory to autodetect from system --- 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)