Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
caosdb
Software
caosdb-advanced-user-tools
Commits
f54451c8
Commit
f54451c8
authored
3 months ago
by
Joscha Schmiedt
Browse files
Options
Downloads
Patches
Plain Diff
FIX: Make temporary paths Windows-compatible
parent
ca946c66
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!128
MNT: Added a warning when column metadata is not configured, and a better...
,
!124
Fix unit tests on Windows
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
unittests/test_caosdbignore.py
+1
-1
1 addition, 1 deletion
unittests/test_caosdbignore.py
unittests/test_suppressKnown.py
+5
-6
5 additions, 6 deletions
unittests/test_suppressKnown.py
unittests/test_utils.py
+3
-3
3 additions, 3 deletions
unittests/test_utils.py
with
9 additions
and
10 deletions
unittests/test_caosdbignore.py
+
1
−
1
View file @
f54451c8
...
...
@@ -44,7 +44,7 @@ class Linkaheadignore(unittest.TestCase):
assert
len
(
files
)
==
3
assert
os
.
path
.
join
(
BASEDIR
,
"
data
"
,
"
datatypes.xlsx
"
)
in
files
assert
os
.
path
.
join
(
BASEDIR
,
"
data
"
,
"
README.xlsx
"
)
in
files
assert
os
.
path
.
join
(
BASEDIR
,
"
data
"
,
"
Publications
/
Posters
/
2019-02-03_something
/
README.md
"
)
in
files
assert
os
.
path
.
join
(
BASEDIR
,
"
data
"
,
"
Publications
"
,
"
Posters
"
,
"
2019-02-03_something
"
,
"
README.md
"
)
in
files
def
test_regex
(
self
):
files
=
[
r
"
/dies/ist/simple
"
,
r
"
/dies/eh(er)/nich?t
"
]
...
...
This diff is collapsed.
Click to expand it.
unittests/test_suppressKnown.py
+
5
−
6
View file @
f54451c8
...
...
@@ -25,7 +25,7 @@
import
logging
import
os
import
unittest
from
tempfile
import
NamedTemporaryFile
from
tempfile
import
NamedTemporaryFile
,
gettempdir
from
caosadvancedtools.suppressKnown
import
SuppressKnown
...
...
@@ -40,7 +40,7 @@ class Record(object):
class
SupTestBasic
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
db_file
=
"
/tmp/
test_suppress_msg_db_file.db
"
self
.
db_file
=
os
.
path
.
join
(
gettempdir
(),
"
test_suppress_msg_db_file
_basic
.db
"
)
self
.
basic
=
SuppressKnown
(
db_file
=
self
.
db_file
)
def
test_msg
(
self
):
...
...
@@ -52,12 +52,12 @@ class SupTestBasic(unittest.TestCase):
self
.
basic
.
filter
(
r
)
def
tearDown
(
self
):
os
.
remove
(
self
.
db_file
)
pass
class
SupTestAdvanced
(
SupTestBasic
):
def
setUp
(
self
):
self
.
db_file
=
"
/tmp/
test_suppress_msg_db_file.db
"
self
.
db_file
=
os
.
path
.
join
(
gettempdir
(),
"
test_suppress_msg_db_file
_advanced
.db
"
)
self
.
basic
=
SuppressKnown
(
db_file
=
self
.
db_file
)
def
test_logger
(
self
):
...
...
@@ -65,13 +65,12 @@ class SupTestAdvanced(SupTestBasic):
The logging output is directed to a file which is then checked whether
the output is as expected.
"""
logfile
=
NamedTemporaryFile
()
logfile
=
NamedTemporaryFile
(
delete
=
False
,
mode
=
"
w
"
)
logger
=
logging
.
getLogger
()
logger
.
addHandler
(
logging
.
FileHandler
(
logfile
.
name
))
logger
.
setLevel
(
logging
.
DEBUG
)
sup
=
SuppressKnown
(
db_file
=
self
.
db_file
)
logger
.
addFilter
(
sup
)
logger
.
info
(
"
hi
"
,
extra
=
{
"
identifier
"
:
"
5
"
,
'
category
'
:
"
test
"
})
with
open
(
logfile
.
name
)
as
lf
:
log
=
lf
.
read
()
...
...
This diff is collapsed.
Click to expand it.
unittests/test_utils.py
+
3
−
3
View file @
f54451c8
...
...
@@ -23,7 +23,7 @@
import
logging
import
unittest
from
tempfile
import
NamedTemporaryFile
import
os
import
linkahead
as
db
from
caosadvancedtools.utils
import
(
check_win_path
,
get_referenced_files
,
string_to_person
,
create_entity_link
)
...
...
@@ -47,7 +47,7 @@ class BaseMockUpTest(unittest.TestCase):
connection
.
_delegate_connection
.
resources
.
append
(
lambda
**
kwargs
:
MockUpResponse
(
200
,
{},
self
.
entities
))
self
.
logfile
=
NamedTemporaryFile
()
self
.
logfile
=
NamedTemporaryFile
(
delete
=
False
)
logger
=
logging
.
getLogger
()
logger
.
addHandler
(
logging
.
FileHandler
(
self
.
logfile
.
name
))
logger
.
setLevel
(
logging
.
DEBUG
)
...
...
@@ -77,7 +77,7 @@ class ReferencesBaseTest(BaseMockUpTest):
files
=
get_referenced_files
(
"
test.npy
"
,
prefix
=
None
,
filename
=
None
,
location
=
None
)
self
.
assertEqual
(
len
(
files
),
1
)
self
.
assertEqual
(
files
[
0
].
path
,
"
/
some
/path/
test.npy
"
)
self
.
assertEqual
(
os
.
path
.
join
(
files
[
0
].
path
,
"
some
"
,
"
path
"
,
"
test.npy
"
)
)
log
=
self
.
get_log
()
assert
"
FIND file which
"
in
log
assert
"
does not allow a search
"
not
in
log
...
...
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