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

Support CXOTIME_NOW environment variable #270

Merged
merged 3 commits into from
Jan 28, 2025
Merged

Conversation

taldcroft
Copy link
Member

@taldcroft taldcroft commented Jan 26, 2025

Description

This fixes cheta to support the CXOTIME_NOW environment variable and use it to mock the current time if defined.

The original code logic ignored that DateTime(None) returns the current time, so this PR fixes that.

Requires

Interface impacts

Testing

Unit tests

  • Mac
(ska3-flight-2025.0rc2) ➜  cheta git:(support-cxotime-now) git rev-parse --short HEAD
7488498
(ska3-flight-2025.0rc2) ➜  cheta git:(support-cxotime-now) pytest                    
=============================================== test session starts ================================================
platform darwin -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
rootdir: /Volumes/git
configfile: pytest.ini
plugins: doctestplus-1.3.0, anyio-4.7.0, timeout-2.3.1
collected 175 items                                                                                                

cheta/tests/test_comps.py ............................................................                       [ 34%]
cheta/tests/test_data_source.py .........                                                                    [ 39%]
cheta/tests/test_fetch.py .................................                                                  [ 58%]
cheta/tests/test_intervals.py .........................                                                      [ 72%]
cheta/tests/test_orbit.py .                                                                                  [ 73%]
cheta/tests/test_remote_access.py ......                                                                     [ 76%]
cheta/tests/test_sync.py ........                                                                            [ 81%]
cheta/tests/test_units.py ...........                                                                        [ 87%]
cheta/tests/test_units_reversed.py ...........                                                               [ 93%]
cheta/tests/test_utils.py ...........                                                                        [100%]

========================================= 175 passed in 128.31s (0:02:08) ==========================================

Independent check of unit tests by Jean

  • osx arm64
(2025.1rc1) flame:cheta jean$ pytest
============================================================= test session starts =============================================================
platform darwin -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
rootdir: /Users/jean/git
configfile: pytest.ini
plugins: anyio-4.7.0, timeout-2.3.1
collected 175 items                                                                                                                           

cheta/tests/test_comps.py ............................................................                                                  [ 34%]
cheta/tests/test_data_source.py .........                                                                                               [ 39%]
cheta/tests/test_fetch.py .................................                                                                             [ 58%]
cheta/tests/test_intervals.py .........................                                                                                 [ 72%]
cheta/tests/test_orbit.py .                                                                                                             [ 73%]
cheta/tests/test_remote_access.py ......                                                                                                [ 76%]
cheta/tests/test_sync.py ........                                                                                                       [ 81%]
cheta/tests/test_units.py ...........                                                                                                   [ 87%]
cheta/tests/test_units_reversed.py ...........                                                                                          [ 93%]
cheta/tests/test_utils.py ...........                                                                                                   [100%]

============================================================== warnings summary ===============================================================
cheta/cheta/tests/test_comps.py::test_cmd_states
  /Users/jean/miniforge3/envs/2025.1rc1/lib/python3.12/site-packages/setuptools_scm/git.py:312: UserWarning: git archive did not support describe output
    warnings.warn("git archive did not support describe output")

cheta/cheta/tests/test_intervals.py::test_fetch_MSID_intervals
  /Users/jean/miniforge3/envs/2025.1rc1/lib/python3.12/site-packages/django/utils/encoding.py:266: DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
    encoding = locale.getdefaultlocale()[1] or 'ascii'

cheta/cheta/tests/test_intervals.py::test_fetch_MSID_intervals
  /Users/jean/miniforge3/envs/2025.1rc1/lib/python3.12/site-packages/django/http/request.py:1: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
    import cgi

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================= 175 passed, 3 warnings in 86.78s (0:01:26

Functional tests

No functional testing.

@jeanconn jeanconn requested a review from Copilot January 28, 2025 17:55
@taldcroft taldcroft merged commit 5c5dd03 into master Jan 28, 2025
2 checks passed
@taldcroft taldcroft deleted the support-cxotime-now branch January 28, 2025 22:30
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