[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Pulp-list] Unit Test Assertions



+1


----- Original Message -----
From: "Jason Dobies" <jason dobies redhat com>
To: pulp-list redhat com
Sent: Friday, May 28, 2010 3:10:29 PM GMT -05:00 US/Canada Eastern
Subject: [Pulp-list] Unit Test Assertions

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

We might want to use the unittest.TestCase assertions instead of simple
assert due to the increased readability of the output.


With just assert:

Traceback (most recent call last):
  File "/home/jdob/vault/code/pulp/test/unit/test_util.py", line 54, in
test_loadConfig
    assert(config.get('paths', 'http_mount') == '/var/lib/pulp')
AssertionError


Using self.assertEqual:

Traceback (most recent call last):
  File "/home/jdob/vault/code/pulp/test/unit/test_util.py", line 54, in
test_loadConfig
    self.assertEqual(config.get('paths', 'http_mount'), '/var/lib/pulp')
AssertionError: '/var/www/pulp' != '/var/lib/pulp'


It's a ton more readable to see the values that are being compared in
the equals rather than just the code.

- -- 
Jason Dobies
RHCE# 805008743336126
Freenode: jdob
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMABUlAAoJEOMmcTqOSQHCAAwIAKrWOCRt7FZRIsy7tuZNGOUc
z8ZVZVc+e9csL+GrGCxI3hRJ5NVIR9y10zW/3gViAhPoaWuURB8VuLtEDJmqLtkW
Dt5xwc9PNRnUkrr3Jke3N7lv+j000vu5qVH+TGtD/YJpzQWZyn+f7at4c403p3BZ
gavyPvX4oOsBfKI6wf9u6U9WBA+sC5RKYFECz9B147n/iVjr2vTJd+OGGLJTuBuM
LKThoddJ/+L/0i5eF3O4Wy4frxNHNk1gGM+IM6gAf+cY0I8VUk+gCDbFLx+iIfg4
G5CMCrE12IkjDumGKrliBaSopXfmqWqEoxhsK44glvjM6A3jD3ixNWG+45lzJh8=
=oeNp
-----END PGP SIGNATURE-----

_______________________________________________
Pulp-list mailing list
Pulp-list redhat com
https://www.redhat.com/mailman/listinfo/pulp-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]