Skip to content
Permalink
Browse files

more tear down

  • Loading branch information
3nids authored and nyalldawson committed Feb 8, 2021
1 parent a0fd777 commit 66051636356d096f3a220a6a8437372a68cb931d
Showing with 22 additions and 13 deletions.
  1. +11 −8 tests/src/python/test_qgsactionmanager.py
  2. +11 −5 tests/src/python/test_qgsrelationeditwidget.py
@@ -35,21 +35,24 @@

class TestQgsActionManager(unittest.TestCase):

def __init__(self, methodName):
"""Run once on class initialization."""
unittest.TestCase.__init__(self, methodName)

self.layer = QgsVectorLayer("Point?field=fldtxt:string&field=fldint:integer&field=flddate:datetime",
@classmethod
def setUpClass(cls):
cls.layer = QgsVectorLayer("Point?field=fldtxt:string&field=fldint:integer&field=flddate:datetime",
"test_layer", "memory")
self.manager = QgsActionManager(self.layer)
cls.manager = QgsActionManager(cls.layer)

# make a little script to aid in recording action outputs
# this is just a little python file which writes out its arguments to a text file
self.run_script_file = os.path.join(QDir.tempPath(), 'run_action.py')
with open(self.run_script_file, 'w') as s:
cls.run_script_file = os.path.join(QDir.tempPath(), 'run_action.py')
with open(cls.run_script_file, 'w') as s:
s.write('import sys\n')
s.write('open(sys.argv[1], "w").write(" ".join(sys.argv[2:]))\n')

@classmethod
def tearDown(cls):
cls.layer = None
cls.manager = None

def get_temp_filename(self):
tmpFile = QTemporaryFile()
tmpFile.open() # fileName is no available until open
@@ -96,13 +96,19 @@ def setUpClass(cls):
assert(cls.vl_editors.isValid())
assert(cls.vl_link_books_authors.isValid())

def setUp(self):
self.startTransaction()
@classmethod
def setUp(cls):
cls.startTransaction()

def tearDown(self):
self.rollbackTransaction()
del self.transaction
@classmethod
def tearDown(cls):
cls.rollbackTransaction()
del cls.transaction
QgsProject.instance().removeAllMapLayers()
cls.vl_books = None
cls.vl_authors = None
cls.vl_editors = None
cls.vl_link_books_authors = None

def test_delete_feature(self):
"""

0 comments on commit 6605163

Please sign in to comment.