Skip to content

Add support for merging list with dict - #256

Merged
psss merged 5 commits into
teemtee:mainfrom
kkaarreell:ks_merge_star
Nov 29, 2024
Merged

psss merged 5 commits into
teemtee:mainfrom
kkaarreell:ks_merge_star

Conversation

@kkaarreell

Copy link
Copy Markdown
Contributor

No description provided.

@kkaarreell

Copy link
Copy Markdown
Contributor Author

it is questionable if we really need a new operator. Can't we simply stick to +?

@kkaarreell

kkaarreell commented Nov 7, 2024 •

Copy link
Copy Markdown
Contributor Author
$ cat main.fmf 
discover:
    - how: fmf
      url: https://github.com/project1
    - how: fmf
      url: https://github.com/project2

/basic:
    summary: Quick set of basic functionality tests
    discover+*:
        filter: "tier:1"

/features:
    summary: Detailed tests for individual features
    discover+*:
        filter: "tier:2"
$ fmf show
/basic
discover: [{'filter': 'tier:1', 'how': 'fmf', 'url': 'https://github.com/project1'},
 {'filter': 'tier:1', 'how': 'fmf', 'url': 'https://github.com/project2'}]
summary: Quick set of basic functionality tests

/features
discover: [{'filter': 'tier:2', 'how': 'fmf', 'url': 'https://github.com/project1'},
 {'filter': 'tier:2', 'how': 'fmf', 'url': 'https://github.com/project2'}]
summary: Detailed tests for individual features

@LecrisUT

LecrisUT commented Nov 7, 2024

Copy link
Copy Markdown
Member

Just a thought, if we go with the * operator, I think it would be better for it to be *+

@kkaarreell

Copy link
Copy Markdown
Contributor Author

So, after reading through the original issue it seems there are more people favoring using the + operator.
With that in mind, I have pushed another commit which modified the code so that only + is used.

I like this option more (if you want to compare both variants see the 1st commit only).

Moreover, now the following use case seems to be handled as well:

discover:
    how: fmf
    prune: True
    adjust-tests:
        - duration+: '*3'
          when: hw == slow

/path:
  discover+:
    - name: upstream
      url: https://some.url
    - name: downstream
      url: https://other.url
$ fmf show
/path
discover: [{'adjust-tests': [{'duration+': '*3', 'when': 'hw == slow'}],
  'how': 'fmf',
  'name': 'upstream',
  'prune': True,
  'url': 'https://some.url'},
 {'adjust-tests': [{'duration+': '*3', 'when': 'hw == slow'}],
  'how': 'fmf',
  'name': 'downstream',
  'prune': True,
  'url': 'https://other.url'}]

Comment thread fmf/base.py Resolved
Comment thread fmf/base.py Resolved
@kkaarreell kkaarreell changed the title Add support for +* operation Add support for merging list with dict Nov 19, 2024
@kkaarreell
kkaarreell force-pushed the ks_merge_star branch 2 times, most recently from 9fc47a2 to 1bedbb5 Compare November 19, 2024 12:56
@kkaarreell

Copy link
Copy Markdown
Contributor Author

@psss Hi, I do not plan any further updates unless requested. Please review.

@kkaarreell

Copy link
Copy Markdown
Contributor Author

/packit retest-failed

@kkaarreell

Copy link
Copy Markdown
Contributor Author

@psss Hi, could you please check failing tests? It doesn't seem related, rather like a change in Fedora distro that is not reflected in tests. Thank you.

@kkaarreell

Copy link
Copy Markdown
Contributor Author

Tests failures doesn't seem to be related. Same failures were present even when I have reverted my commits.

@psss psss added this to the 1.5 milestone Nov 26, 2024
@psss psss added the base label Nov 29, 2024
@psss psss linked an issue Nov 29, 2024 that may be closed by this pull request
@psss
psss merged commit 4b2c82c into teemtee:main Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support inheritance when parent is a list and child is not a list

5 participants