Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
2b7ab33b
Commit
2b7ab33b
authored
7 years ago
by
Bienchen
Browse files
Options
Downloads
Patches
Plain Diff
Making naccess a bit more secure with dots
parent
cac56d83
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/bindings/pymod/naccess.py
+2
-2
2 additions, 2 deletions
modules/bindings/pymod/naccess.py
modules/bindings/tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
modules/bindings/tests/CMakeLists.txt
modules/bindings/tests/test_naccess.py
+42
-0
42 additions, 0 deletions
modules/bindings/tests/test_naccess.py
with
45 additions
and
2 deletions
modules/bindings/pymod/naccess.py
+
2
−
2
View file @
2b7ab33b
...
...
@@ -60,9 +60,9 @@ def _SetupFiles(entity, selection, scratch_dir, max_number_of_atoms):
raise
RuntimeError
,
"
Could not create view for selection (%s)
"
%
(
selection
)
# write entity to tmp file
tmp_file_name
=
os
.
path
.
join
(
tmp_dir_name
,
"
entity.pdb
"
)
tmp_file_name
=
"
entity.pdb
"
tmp_file_base
=
os
.
path
.
join
(
tmp_dir_name
,
"
entity
"
)
io
.
SavePDB
(
entity_view
,
tmp_file_name
)
io
.
SavePDB
(
entity_view
,
os
.
path
.
join
(
tmp_dir_name
,
tmp_file_name
)
)
return
(
tmp_dir_name
,
tmp_file_name
,
tmp_file_base
)
...
...
This diff is collapsed.
Click to expand it.
modules/bindings/tests/CMakeLists.txt
+
1
−
0
View file @
2b7ab33b
...
...
@@ -4,6 +4,7 @@ set(OST_BINDINGS_UNIT_TESTS
test_hhblits.py
test_blast.py
test_kclust.py
test_naccess.py
)
ost_unittest
(
MODULE bindings
...
...
This diff is collapsed.
Click to expand it.
modules/bindings/tests/test_naccess.py
0 → 100644
+
42
−
0
View file @
2b7ab33b
'''
Unit tests for the Naccess wrapper
'''
import
unittest
import
os
import
sys
import
shutil
import
tempfile
from
ost.bindings
import
naccess
from
ost
import
io
class
TestNaccessBindings
(
unittest
.
TestCase
):
def
testTempDirWithDot
(
self
):
# naccess itself has problems with '.' in the path. So we need to test
# that it works when data is used which has a correpsonding path.
na_tmp_dir
=
tempfile
.
mkdtemp
(
prefix
=
"
ih.
"
)
def
cleanup
():
shutil
.
rmtree
(
na_tmp_dir
)
self
.
addCleanup
(
cleanup
)
na_bin
=
os
.
path
.
join
(
os
.
getenv
(
'
EBROOTNACCESS
'
),
'
naccess
'
)
ost_ent
=
io
.
LoadPDB
(
'
testfiles/testprotein.pdb
'
)
excp_raised
=
False
try
:
sasa
=
naccess
.
CalculateSurfaceArea
(
ost_ent
,
scratch_dir
=
na_tmp_dir
,
naccess_exe
=
na_bin
)
except
:
excp_raised
=
True
raise
self
.
assertEquals
(
excp_raised
,
False
,
msg
=
"
Naccess raised an
"
+
"
exception on a path containing a
'
.
'
. This is not
"
+
"
supposed to happen.
"
)
if
__name__
==
"
__main__
"
:
naccess_dir
=
os
.
getenv
(
'
EBROOTNACCESS
'
)
if
not
naccess_dir
:
print
"
No environment variable
'
EBROOTNACCESS
'
. To enable the
"
+
\
"
unit test, this needs to point to your Naccess installation.
"
sys
.
exit
(
0
)
from
ost
import
testutils
testutils
.
RunTests
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment