Skip to content


Add method for file comparison to testing lib
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 21, 2016
1 parent 4c63c85 commit 6a8b407
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/testing/
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import os
import sys
import difflib

from PyQt4.QtCore import QVariant
from qgis.core import QgsApplication, QgsFeatureRequest, QgsVectorLayer
Expand Down Expand Up @@ -140,6 +141,19 @@ def assertLayersEqual(self, layer_expected, layer_result, **kwargs):

def assertFilesEqual(self, filepath_expected, filepath_result):
with open(filepath_expected, 'r') as file_expected:
with open(filepath_result, 'r') as file_result:
diff = difflib.unified_diff(
diff = list(diff)
self.assertEqual(0, len(diff), ''.join(diff))

# Patch unittest
unittest.TestCase = TestCase

Expand Down

0 comments on commit 6a8b407

Please sign in to comment.