Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
e3-require
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Anders Lindh Olsson
e3-require
Commits
55c4b3f4
Commit
55c4b3f4
authored
1 year ago
by
Simon Rose
Browse files
Options
Downloads
Patches
Plain Diff
Fix issue with multiple records that include dbCommon.dbd
parent
7aa82814
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
require-ess/tools/expandDBD
+3
-2
3 additions, 2 deletions
require-ess/tools/expandDBD
tests/test_expand_dbd.py
+17
-0
17 additions, 0 deletions
tests/test_expand_dbd.py
with
20 additions
and
2 deletions
require-ess/tools/expandDBD
+
3
−
2
View file @
55c4b3f4
...
...
@@ -39,9 +39,10 @@ def open_dbd_file(current_file, filename, includes=None):
if
dbd_file
is
None
:
print
(
"
File
'
{basename}
'
not found
"
.
format
(
basename
=
basename
),
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
SCANNED_FILES
.
add
(
basename
)
if
basename
!=
"
dbCommon.dbd
"
:
SCANNED_FILES
.
add
(
basename
)
with
open
(
dbd_file
,
"
r
"
)
as
f
:
return
[
line
.
strip
()
for
line
in
f
.
readlines
()]
return
[
line
.
r
strip
()
for
line
in
f
.
readlines
()]
def
expand_dbd_file
(
current_file
,
dbdlines
,
includes
):
...
...
This diff is collapsed.
Click to expand it.
tests/test_expand_dbd.py
+
17
−
0
View file @
55c4b3f4
...
...
@@ -60,6 +60,23 @@ def test_skip_repeated_includes(tmp_path, expanddbdtcl):
assert
"
Info: skipping duplicate file b.dbd included from
"
in
result
.
stderr
def
test_do_not_skip_repeated_include_common_dbd
(
tmp_path
,
expanddbdtcl
):
dbd_a
=
tmp_path
/
"
a.dbd
"
dbd_a
.
write_text
(
"
include dbCommon.dbd
\n
include dbCommon.dbd
"
)
dbd_b
=
tmp_path
/
"
dbCommon.dbd
"
dbd_b
.
write_text
(
"
content
"
)
result
=
subprocess
.
run
(
[
expanddbdtcl
,
"
-I
"
,
str
(
tmp_path
),
dbd_a
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
encoding
=
"
utf-8
"
,
)
assert
result
.
returncode
==
0
assert
result
.
stdout
==
"
content
\n
content
\n
"
def
test_record_names_from_dbds
(
tmp_path
,
expanddbdtcl
):
dbd_a
=
tmp_path
/
"
a.dbd
"
dbd_a
.
write_text
(
"
include aRecord.dbd
"
)
...
...
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