Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toolbox
WindEnergyToolbox
Commits
85389b27
There was a problem fetching the pipeline summary.
Commit
85389b27
authored
7 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
A little more updates for test_files.py
parent
b6e86eab
No related branches found
No related tags found
1 merge request
!38
Resolve "test_files solution is temporary"
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/utils/test_files.py
+11
-4
11 additions, 4 deletions
wetb/utils/test_files.py
wetb/utils/tests/test_test_files.py
+1
-1
1 addition, 1 deletion
wetb/utils/tests/test_test_files.py
with
12 additions
and
5 deletions
wetb/utils/test_files.py
+
11
−
4
View file @
85389b27
...
@@ -8,12 +8,17 @@ import wetb
...
@@ -8,12 +8,17 @@ import wetb
import
inspect
import
inspect
wetb_rep_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
wetb
.
__file__
),
"
../
"
)
wetb_rep_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
wetb
.
__file__
),
"
../
"
)
def
get_test_file
(
filename
):
def
_absolute_filename
(
filename
):
if
not
os
.
path
.
isabs
(
filename
):
if
not
os
.
path
.
isabs
(
filename
):
index
=
[
os
.
path
.
realpath
(
s
[
1
])
for
s
in
inspect
.
stack
()].
index
(
__file__
)
+
1
index
=
[
os
.
path
.
realpath
(
s
[
1
])
for
s
in
inspect
.
stack
()].
index
(
__file__
)
+
2
tfp
=
os
.
path
.
dirname
(
inspect
.
stack
()[
index
][
1
])
+
"
/test_files/
"
caller_module_path
=
os
.
path
.
dirname
(
inspect
.
stack
()[
index
][
1
])
tfp
=
caller_module_path
+
"
/test_files/
"
filename
=
tfp
+
filename
filename
=
tfp
+
filename
return
filename
def
get_test_file
(
filename
):
filename
=
_absolute_filename
(
filename
)
if
os
.
path
.
exists
(
filename
):
if
os
.
path
.
exists
(
filename
):
return
filename
return
filename
else
:
else
:
...
@@ -23,6 +28,8 @@ def get_test_file(filename):
...
@@ -23,6 +28,8 @@ def get_test_file(filename):
def
move2test_files
(
filename
):
def
move2test_files
(
filename
):
filename
=
_absolute_filename
(
filename
)
assert
os
.
path
.
isfile
(
filename
),
filename
dst_filename
=
os
.
path
.
join
(
wetb_rep_path
,
'
TestFiles
'
,
os
.
path
.
relpath
(
filename
,
wetb_rep_path
))
dst_filename
=
os
.
path
.
join
(
wetb_rep_path
,
'
TestFiles
'
,
os
.
path
.
relpath
(
filename
,
wetb_rep_path
))
folder
=
os
.
path
.
dirname
(
dst_filename
)
folder
=
os
.
path
.
dirname
(
dst_filename
)
if
not
os
.
path
.
exists
(
folder
):
if
not
os
.
path
.
exists
(
folder
):
...
...
This diff is collapsed.
Click to expand it.
wetb/utils/tests/test_test_files.py
+
1
−
1
View file @
85389b27
...
@@ -27,7 +27,7 @@ class Test_test_files(unittest.TestCase):
...
@@ -27,7 +27,7 @@ class Test_test_files(unittest.TestCase):
fn1
=
get_test_file
(
tfp
+
'
test_file.txt
'
)
fn1
=
get_test_file
(
tfp
+
'
test_file.txt
'
)
self
.
assertTrue
(
fn1
)
self
.
assertTrue
(
fn1
)
fn2
=
get_test_file
(
'
test_file.txt
'
)
fn2
=
get_test_file
(
'
test_file.txt
'
)
self
.
assertEqual
(
fn
2
,
fn
1
)
self
.
assertEqual
(
fn
1
,
fn
2
)
...
...
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