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
Merge requests
!37
Resolve "Utilization of TestFiles repository"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Utilization of TestFiles repository"
57-utilization-of-testfiles-repository
into
master
Overview
0
Commits
4
Pipelines
1
Changes
8
Merged
Mads M. Pedersen
requested to merge
57-utilization-of-testfiles-repository
into
master
7 years ago
Overview
0
Commits
4
Pipelines
1
Changes
8
Expand
Closes
#57 (closed)
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
8ea05361
4 commits,
7 years ago
8 files
+
183
−
108
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
wetb/utils/tests/test_test_files.py
0 → 100644
+
41
−
0
Options
'''
Created on 20. jul. 2017
@author: mmpe
'''
import
unittest
from
wetb.utils.test_files
import
move2test_files
,
get_test_file
import
os
from
wetb.utils
import
test_files
import
wetb
tfp
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
)
+
"
/test_files/
"
)
class
Test_test_files
(
unittest
.
TestCase
):
def
test_move2test_files
(
self
):
dst
=
test_files
.
default_TestFile_rep_path
+
"
wetb/utils/tests/test_files/tmp_test_file.txt
"
src
=
tfp
+
'
tmp_test_file.txt
'
if
os
.
path
.
isdir
(
test_files
.
default_TestFile_rep_path
):
if
os
.
path
.
isfile
(
dst
):
os
.
remove
(
dst
)
if
not
os
.
path
.
isfile
(
src
):
with
open
(
src
,
'
w
'
)
as
fid
:
fid
.
write
(
"
This is a test file
"
)
move2test_files
(
src
)
self
.
assertTrue
(
os
.
path
.
isfile
(
dst
))
def
test_test_files
(
self
):
fn
=
os
.
path
.
realpath
(
os
.
path
.
dirname
(
wetb
.
__file__
)
+
'
/../downloaded_test_files/wetb/utils/tests/test_files/test_file.txt
'
)
if
os
.
path
.
isfile
(
fn
):
os
.
remove
(
fn
)
fn1
=
get_test_file
(
tfp
+
'
test_file.txt
'
)
self
.
assertTrue
(
fn1
)
os
.
remove
(
fn1
)
fn2
=
get_test_file
(
'
test_file.txt
'
)
self
.
assertEqual
(
fn2
,
fn
)
self
.
assertTrue
(
os
.
path
.
isfile
(
fn2
))
if
__name__
==
"
__main__
"
:
#import sys;sys.argv = ['', 'Test.testName']
unittest
.
main
()
\ No newline at end of file
Loading