Skip to content
Permalink
Browse files

Fix warnings in test

  • Loading branch information
nyalldawson committed Nov 4, 2020
1 parent a092a82 commit e5fe9bf42303e9fc93861544a252e8a950f718c9
Showing with 15 additions and 15 deletions.
  1. +15 −15 tests/src/python/test_qgsfileutils.py
@@ -118,25 +118,25 @@ def testAutoFinder(self):
files = QgsFileUtils.findFile(filename, nest, 1, 13)
self.assertEqual(len(files), 0)
# side nest
open(os.path.join(side_nest, filename), 'w+')
files = QgsFileUtils.findFile(os.path.join(base_folder, filename))
self.assertEqual(files[0], os.path.join(side_nest, filename).replace(os.sep, '/'))
with open(os.path.join(side_nest, filename), 'w+'):
files = QgsFileUtils.findFile(os.path.join(base_folder, filename))
self.assertEqual(files[0], os.path.join(side_nest, filename).replace(os.sep, '/'))
# side + side nest = 2
open(os.path.join(side_fold, filename), 'w+')
files = QgsFileUtils.findFile(filename, base_folder, 3, 4)
self.assertEqual(len(files), 2)
with open(os.path.join(side_fold, filename), 'w+'):
files = QgsFileUtils.findFile(filename, base_folder, 3, 4)
self.assertEqual(len(files), 2)
# up
open(os.path.join(temp_folder, filename), 'w+')
files = QgsFileUtils.findFile(filename, base_folder, 3, 4)
self.assertEqual(files[0], os.path.join(temp_folder, filename).replace(os.sep, '/'))
with open(os.path.join(temp_folder, filename), 'w+'):
files = QgsFileUtils.findFile(filename, base_folder, 3, 4)
self.assertEqual(files[0], os.path.join(temp_folder, filename).replace(os.sep, '/'))
# nest
open(os.path.join(nest, filename), 'w+')
files = QgsFileUtils.findFile(os.path.join(base_folder, filename))
self.assertEqual(files[0], os.path.join(nest, filename).replace(os.sep, '/'))
with open(os.path.join(nest, filename), 'w+'):
files = QgsFileUtils.findFile(os.path.join(base_folder, filename))
self.assertEqual(files[0], os.path.join(nest, filename).replace(os.sep, '/'))
# base level
open(os.path.join(base_folder, filename), 'w+')
files = QgsFileUtils.findFile(filename, base_folder, 2, 4)
self.assertEqual(files[0], os.path.join(base_folder, filename).replace(os.sep, '/'))
with open(os.path.join(base_folder, filename), 'w+'):
files = QgsFileUtils.findFile(filename, base_folder, 2, 4)
self.assertEqual(files[0], os.path.join(base_folder, filename).replace(os.sep, '/'))
# invalid path, too deep
files = QgsFileUtils.findFile(filename, os.path.join(nest, 'nest2'), 2, 4)
self.assertEqual(files[0], os.path.join(nest, filename).replace(os.sep, '/'))

0 comments on commit e5fe9bf

Please sign in to comment.
You can’t perform that action at this time.