[tracker-miners/wip/carlosg/test-error-fixes] tests: Make test assertion clearer



commit f2e640906b6fcee30cb003ee0d0c11a8a3f745bb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jul 14 13:12:38 2021 +0200

    tests: Make test assertion clearer
    
    If the elements in the resultset differ from what we expect here,
    we just print an unhelpful:
    
      AssertionError: 2 != 1
    
    But it doesn't tell which file is there that should not be. Assert
    on the array contents, so that we get nicer diff prints when the
    result does not match.

 tests/functional-tests/miner-basic.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/tests/functional-tests/miner-basic.py b/tests/functional-tests/miner-basic.py
index ad386ca72..e259fb9cf 100755
--- a/tests/functional-tests/miner-basic.py
+++ b/tests/functional-tests/miner-basic.py
@@ -333,9 +333,7 @@ class MinerCrawlTest(fixtures.TrackerMinerTest):
             shutil.rmtree(victim)
 
         result = self.__get_text_documents()
-        self.assertEqual(len(result), 1)
-        unpacked_result = [r[0] for r in result]
-        self.assertIn(self.uri("test-monitored/file1.txt"), unpacked_result)
+        self.assertEqual(result, [[self.uri("test-monitored/file1.txt")]])
 
         # Restore the dirs
         os.makedirs(self.path("test-monitored/dir1"))


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