[Patchew-devel] [PATCH 2/9] test_message: just use a single from

Paolo Bonzini posted 9 patches 6 years ago
[Patchew-devel] [PATCH 2/9] test_message: just use a single from
Posted by Paolo Bonzini 6 years ago
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/test_message.py | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tests/test_message.py b/tests/test_message.py
index 69dcde8..bc0a98d 100755
--- a/tests/test_message.py
+++ b/tests/test_message.py
@@ -8,27 +8,26 @@
 # This work is licensed under the MIT License.  Please see the LICENSE file or
 # http://opensource.org/licenses/MIT.
 
+import json
 import time
 import datetime
 
 from .patchewtest import PatchewTestCase, main
 
+from api.models import Message
 
-class ProjectTest(PatchewTestCase):
+
+class MessageTest(PatchewTestCase):
     def setUp(self):
         self.create_superuser()
 
     def test_0_second(self):
-        from api.models import Message
-
         message = Message()
         message.date = datetime.datetime.utcnow()
         age = message.get_age()
         self.assertEqual(age, "0 second")
 
     def test_now(self):
-        from api.models import Message
-
         message = Message()
         dt = datetime.datetime.fromtimestamp(time.time() + 100)
         message.date = dt
@@ -36,8 +35,6 @@ class ProjectTest(PatchewTestCase):
         self.assertEqual(age, "now")
 
     def test_1_day(self):
-        from api.models import Message
-
         message = Message()
         dt = datetime.datetime.fromtimestamp(time.time() - 3600 * 25)
         message.date = dt
@@ -45,8 +42,6 @@ class ProjectTest(PatchewTestCase):
         self.assertEqual(age, "1 day")
 
     def test_asctime(self):
-        from api.models import Message
-
         message = Message()
         dt = datetime.datetime(2016, 10, 22, 10, 16, 40)
         message.date = dt
-- 
2.21.0


_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel

Re: [Patchew-devel] [PATCH 2/9] test_message: just use a single from
Posted by Philippe Mathieu-Daudé 6 years ago
On 1/16/20 4:09 PM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   tests/test_message.py | 13 ++++---------
>   1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/test_message.py b/tests/test_message.py
> index 69dcde8..bc0a98d 100755
> --- a/tests/test_message.py
> +++ b/tests/test_message.py
> @@ -8,27 +8,26 @@
>   # This work is licensed under the MIT License.  Please see the LICENSE file or
>   # http://opensource.org/licenses/MIT.
>   
> +import json
>   import time
>   import datetime
>   
>   from .patchewtest import PatchewTestCase, main
>   
> +from api.models import Message
>   
> -class ProjectTest(PatchewTestCase):
> +
> +class MessageTest(PatchewTestCase):
>       def setUp(self):
>           self.create_superuser()
>   
>       def test_0_second(self):
> -        from api.models import Message
> -
>           message = Message()
>           message.date = datetime.datetime.utcnow()
>           age = message.get_age()
>           self.assertEqual(age, "0 second")
>   
>       def test_now(self):
> -        from api.models import Message
> -
>           message = Message()
>           dt = datetime.datetime.fromtimestamp(time.time() + 100)
>           message.date = dt
> @@ -36,8 +35,6 @@ class ProjectTest(PatchewTestCase):
>           self.assertEqual(age, "now")
>   
>       def test_1_day(self):
> -        from api.models import Message
> -
>           message = Message()
>           dt = datetime.datetime.fromtimestamp(time.time() - 3600 * 25)
>           message.date = dt
> @@ -45,8 +42,6 @@ class ProjectTest(PatchewTestCase):
>           self.assertEqual(age, "1 day")
>   
>       def test_asctime(self):
> -        from api.models import Message
> -
>           message = Message()
>           dt = datetime.datetime(2016, 10, 22, 10, 16, 40)
>           message.date = dt
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel