Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve validation: YAML data files and set KADI_COMMANDS_DEFAULT_STOP #339

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

taldcroft
Copy link
Member

@taldcroft taldcroft commented Oct 26, 2024

Description

Reformulate the validation regression test data as plain text YAML. This allows seeing diffs in a meaningful way.

Update certain validation test functions to run with KADI_COMMANDS_DEFAULT_STOP set to the end of the regression test interval. This forces local regeneration of the commands using the Chandra Command Events sheet and the current definitions in command_sets.py. In this way local code changes are reflected in the commands; otherwise the file commands archive is used.

Also add a fixture to do the kadi commands processing in a temporary directory.

Interface impacts

Testing

Unit tests

  • Mac
(ska3) ➜  kadi git:(better-validation-regression-data) git rev-parse HEAD 
66a47bbb6feccb67d0d255f922a76175c85bc4fa
(ska3) ➜  kadi git:(better-validation-regression-data) pytest             
====================================================== test session starts ======================================================
platform darwin -- Python 3.11.8, pytest-7.4.4, pluggy-1.4.0
rootdir: /Users/aldcroft/git
configfile: pytest.ini
plugins: timeout-2.2.0, anyio-4.3.0
collected 181 items                                                                                                             

kadi/commands/tests/test_commands.py .................................................................................    [ 44%]
kadi/commands/tests/test_states.py .......................x.........................                                      [ 71%]
kadi/commands/tests/test_validate.py ...................                                                                  [ 82%]
kadi/tests/test_events.py ..........                                                                                      [ 87%]
kadi/tests/test_occweb.py ......................                                                                          [100%]

========================================== 180 passed, 1 xfailed in 108.08s (0:01:48) ===========================================

Independent check of unit tests by Jean

  • Linux
(ska3-masters) jeanconn-fido> pytest
========================================================= test session starts =========================================================
platform linux -- Python 3.11.8, pytest-7.4.4, pluggy-1.4.0
rootdir: /proj/sot/ska/jeanproj/git
configfile: pytest.ini
plugins: timeout-2.2.0, anyio-4.3.0
collected 181 items                                                                                                                   

kadi/commands/tests/test_commands.py .................................................................................          [ 44%]
kadi/commands/tests/test_states.py .......................x.........................                                            [ 71%]
kadi/commands/tests/test_validate.py ...................                                                                        [ 82%]
kadi/tests/test_events.py ..........                                                                                            [ 87%]
kadi/tests/test_occweb.py ......................                                                                                [100%]

============================================= 180 passed, 1 xfailed in 221.00s (0:03:41) ==============================================
(ska3-masters) jeanconn-fido> git rev-parse HEAD
66a47bbb6feccb67d0d255f922a76175c85bc4fa

Functional tests

No functional testing.

name = f"validators_{stop.replace(':', '')}_{days}_{no_exclude}.pkl.gz"
path = cwd / "data" / name
This fixture cannot be combined with the module-scoped ``local_testing`` fixture
because this causes problems for other tests that rely on the default stop time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused here, as with the signature regress_stop(local_testing) isn't the fixture already combined with the local_testing fixture?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the comment is indeed a little confusing. It should be "The commands in this fixture cannot be included in the module-scoped ...". Basically setting KADI_COMMANDS_DEFAULT_STOP for the entire module will break some tests.

@taldcroft taldcroft merged commit b7afc73 into master Oct 29, 2024
4 checks passed
@taldcroft taldcroft deleted the better-validation-regression-data branch October 29, 2024 12:51
@javierggt javierggt mentioned this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants