Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
b4d84d51
Commit
b4d84d51
authored
4 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
check_functionality: read script in main routine
parent
3e01eb1c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/Functional/Python/PyExamples/check_functionality.py
+7
-7
7 additions, 7 deletions
Tests/Functional/Python/PyExamples/check_functionality.py
with
7 additions
and
7 deletions
Tests/Functional/Python/PyExamples/check_functionality.py
+
7
−
7
View file @
b4d84d51
...
@@ -18,20 +18,19 @@ def get_figure(figsize):
...
@@ -18,20 +18,19 @@ def get_figure(figsize):
return
plt
.
figure
(
figsize
=
(
figsize
[
0
]
/
dpi
,
figsize
[
1
]
/
dpi
))
return
plt
.
figure
(
figsize
=
(
figsize
[
0
]
/
dpi
,
figsize
[
1
]
/
dpi
))
def
exec_full
(
filepath
):
def
exec_full
(
script
,
filename
):
"""
"""
Executes embedded python script.
Executes embedded python script.
http://stackoverflow.com/questions/436198/what-is-an-alternative-to-execfile-in-python-3
http://stackoverflow.com/questions/436198/what-is-an-alternative-to-execfile-in-python-3
"""
"""
import
os
import
os
global_namespace
=
{
global_namespace
=
{
"
__file__
"
:
file
path
,
"
__file__
"
:
file
name
,
"
__name__
"
:
"
__main__
"
,
"
__name__
"
:
"
__main__
"
,
"
__no_terminal__
"
:
True
"
__no_terminal__
"
:
True
}
}
sys
.
argv
=
[]
# TODO: FIXME after cleanup in plot_utils
sys
.
argv
=
[]
with
open
(
filepath
,
'
rb
'
)
as
file
:
exec
(
compile
(
script
,
filename
,
'
exec
'
),
global_namespace
)
exec
(
compile
(
file
.
read
(),
filepath
,
'
exec
'
),
global_namespace
)
def
run_example
(
filename
,
output_dir
):
def
run_example
(
filename
,
output_dir
):
...
@@ -40,8 +39,9 @@ def run_example(filename, output_dir):
...
@@ -40,8 +39,9 @@ def run_example(filename, output_dir):
"""
"""
if
not
os
.
path
.
exists
(
filename
):
if
not
os
.
path
.
exists
(
filename
):
raise
Exception
(
"
Example script
'"
+
filename
+
"'
not found
"
)
raise
Exception
(
"
Example script
'"
+
filename
+
"'
not found
"
)
print
(
"
Input script:
"
+
filename
,
flush
=
True
)
print
(
"
Input script:
"
+
filename
,
flush
=
True
)
with
open
(
filename
,
'
rb
'
)
as
file
:
script
=
file
.
read
()
if
"
AllFormFactorsAvailable
"
in
filename
:
if
"
AllFormFactorsAvailable
"
in
filename
:
figsize
=
(
1024
,
768
)
figsize
=
(
1024
,
768
)
...
@@ -49,7 +49,7 @@ def run_example(filename, output_dir):
...
@@ -49,7 +49,7 @@ def run_example(filename, output_dir):
figsize
=
(
640
,
480
)
figsize
=
(
640
,
480
)
fig
=
get_figure
(
figsize
)
fig
=
get_figure
(
figsize
)
exec_full
(
filename
)
exec_full
(
script
,
filename
)
print
(
"
Input script completed.
"
,
flush
=
True
)
print
(
"
Input script completed.
"
,
flush
=
True
)
plot_file_name
=
os
.
path
.
join
(
plot_file_name
=
os
.
path
.
join
(
...
...
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