Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
3712c0a5
Unverified
Commit
3712c0a5
authored
Oct 03, 2018
by
Simon Heybrock
Committed by
GitHub
Oct 03, 2018
Browse files
Merge pull request #23565 from mantidproject/23564_ProjectRecoveryUnitTests
Project Recovery: Add Unit Tests
parents
9e68e7b8
de0ad1dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
MantidPlot/CMakeLists.txt
View file @
3712c0a5
...
...
@@ -891,6 +891,7 @@ set ( MANTIDPLOT_TEST_PY_FILES
MantidPlotMdiSubWindowTest.py
MantidPlotTiledWindowTest.py
MantidPlotInputArgsCheck.py
MantidPlotProjectRecovery.py
TSVSerialiserTest.py
)
...
...
MantidPlot/test/MantidPlotProjectRecovery.py
0 → 100644
View file @
3712c0a5
import
mantidplottests
import
os
import
platform
import
unittest
import
mantidplot
from
mantidplottests
import
runTests
,
threadsafe_call
from
glob
import
glob
#from mantid.kernel import *
from
mantid
import
AnalysisDataService
,
ConfigService
from
mantid.simpleapi
import
CreateWorkspace
from
PyQt4
import
QtGui
import
shutil
import
_qti
path
=
os
.
path
.
join
(
ConfigService
.
getAppDataDirectory
(),
'recovery'
,
platform
.
node
())
def
cleanUp
():
# Clean Up
for
cc
in
glob
(
os
.
path
.
join
(
path
,
"*"
,
""
)):
shutil
.
rmtree
(
cc
)
AnalysisDataService
.
clear
()
class
MantidPlotProjectRecovery
(
unittest
.
TestCase
):
def
test_exec
(
self
):
CreateWorkspace
(
OutputWorkspace
=
"ws"
,
DataX
=
[
1
,
2
,
3
],
DataY
=
[
1
,
2
,
3
],
NSpec
=
1
)
threadsafe_call
(
_qti
.
app
.
saveRecoveryCheckpoint
)
cleanUp
()
#Test that it cleaned up after itself
self
.
assertEqual
(
len
(
glob
(
os
.
path
.
join
(
path
,
"*"
,
""
))),
0
)
def
test_checkpoint_creation
(
self
):
CreateWorkspace
(
OutputWorkspace
=
"ws"
,
DataX
=
[
1
,
2
,
3
],
DataY
=
[
1
,
2
,
3
],
NSpec
=
1
)
listOfCheckpointsBefore
=
glob
(
os
.
path
.
join
(
path
,
"*"
,
""
))
for
ii
in
listOfCheckpointsBefore
:
shutil
.
rmtree
(
ii
)
threadsafe_call
(
_qti
.
app
.
saveRecoveryCheckpoint
)
listOfCheckpointsAfter
=
glob
(
os
.
path
.
join
(
path
,
"*"
,
""
))
self
.
assertEqual
(
len
(
listOfCheckpointsAfter
),
1
)
cleanUp
()
#Test that it cleaned up after itself
self
.
assertEqual
(
len
(
glob
(
os
.
path
.
join
(
path
,
"*"
,
""
))),
0
)
# Run the unit tests
mantidplottests
.
runTests
(
MantidPlotProjectRecovery
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment