Skip to content

force_sequence example added #75

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

amccann-Tek
Copy link

Proposed changes

Updated documentation and examples for force_sequence(). No direct src changes.

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Functionality update (non-breaking change which updates or changes existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • CI/CD update (an update to the CI/CD workflows, scripts, and/or configurations)
  • Documentation update (an update to enhance the user experience when reading through the docs)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have followed the guidelines in the CONTRIBUTING document
  • I have signed the CLA
  • I have checked to ensure there aren't other open Pull Requests for the same update/change
  • I have created (or updated) an Issue to track the status of this update/change and updated the link in this PR description (see above in the Proposed changes section) using the wording Addresses #<issue_number>
  • I have performed a self-review of my code
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • Basic linting passes locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added necessary documentation (if appropriate)
  • I have updated the Changelog with a brief description of my changes

@amccann-Tek amccann-Tek requested a review from a team as a code owner April 17, 2025 22:11
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.72%. Comparing base (ad37893) to head (ac237ad).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #75   +/-   ##
=======================================
  Coverage   80.72%   80.72%           
=======================================
  Files           3        3           
  Lines         524      524           
  Branches       94       94           
=======================================
  Hits          423      423           
  Misses         82       82           
  Partials       19       19           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

amccann-Tek and others added 4 commits April 18, 2025 08:35
Co-authored-by: Nicholas Felt <[email protected]>
Signed-off-by: Andrew McCann <[email protected]>
Co-authored-by: Nicholas Felt <[email protected]>
Signed-off-by: Andrew McCann <[email protected]>
Co-authored-by: Nicholas Felt <[email protected]>
Signed-off-by: Andrew McCann <[email protected]>
Co-authored-by: Nicholas Felt <[email protected]>
Signed-off-by: Andrew McCann <[email protected]>
Co-authored-by: Nicholas Felt <[email protected]>
Signed-off-by: Andrew McCann <[email protected]>
Copy link

github-actions bot commented Apr 18, 2025

Test Results (ubuntu)

path passed failed subtotal
tests/test_client.py 61 1 62
tests/test_logging.py 3 3
TOTAL 64 1 65
tests/test_client.py
tekhsi_client = <tekhsi.tek_hsi_connect.TekHSIConnect object at 0x7f7819088140>
capsys = <_pytest.capture.CaptureFixture object at 0x7f7818f6b470>
instrument = True, sum_count = 5, sum_acq_time = 10.0, sum_data_rate = 50.0
expected_output = 'Average Update Rate:0.50, Data Rate:10.00Mbs'

    @pytest.mark.parametrize(
        ("instrument", "sum_count", "sum_acq_time", "sum_data_rate", "expected_output"),
        [
            (True, 5, 10.0, 50.0, "Average Update Rate:0.50, Data Rate:10.00Mbs"),
        ],
    )
    def test_server_connection(
        tekhsi_client: TekHSIConnect,
        capsys: pytest.CaptureFixture[str],
        instrument: bool,
        sum_count: int,
        sum_acq_time: float,
        sum_data_rate: float,
        expected_output: str,
    ) -> None:
        """Test the server connection using the TekHSI client.
    
        Args:
            tekhsi_client: An instance of the TekHSI client to be tested.
            capsys (CaptureFixture): Pytest fixture to capture system output.
            instrument: Whether the instrument is connected.
            sum_count: The sum count.
            sum_acq_time: The sum acquisition time.
            sum_data_rate: The sum data rate.
            expected_output: The expected output message.
        """
        # Set the required attributes
        tekhsi_client._instrument = instrument
        tekhsi_client._sum_count = sum_count
        tekhsi_client._sum_acq_time = sum_acq_time
        tekhsi_client._sum_data_rate = sum_data_rate
    
        # Set the verbose attribute to True
        tekhsi_client.verbose = True
        # Use the context manager to handle connection
>       with tekhsi_client as connection:

capsys     = <_pytest.capture.CaptureFixture object at 0x7f7818f6b470>
captured   = CaptureResult(out='2025-04-18 16:20:46.000492 - enter()\n', err='')
connection = <tekhsi.tek_hsi_connect.TekHSIConnect object at 0x7f7819088140>
expected_output = 'Average Update Rate:0.50, Data Rate:10.00Mbs'
instrument = True
request    = name: "test_client"

response   = status: CONNECTSTATUS_SUCCESS

sum_acq_time = 10.0
sum_count  = 5
sum_data_rate = 50.0
tekhsi_client = <tekhsi.tek_hsi_connect.TekHSIConnect object at 0x7f7819088140>

tests/test_client.py:58: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.tox/tests/lib/python3.12/site-packages/tekhsi/tek_hsi_connect.py:211: in __exit__
    self.close()
        exc_tb     = None
        exc_type   = None
        exc_val    = None
        self       = <tekhsi.tek_hsi_connect.TekHSIConnect object at 0x7f7819088140>
.tox/tests/lib/python3.12/site-packages/tekhsi/tek_hsi_connect.py:443: in close
    self.force_sequence()
        self       = <tekhsi.tek_hsi_connect.TekHSIConnect object at 0x7f7819088140>
.tox/tests/lib/python3.12/site-packages/tekhsi/tek_hsi_connect.py:513: in force_sequence
    self.connection.RequestNewSequence(request)
        request    = name: "8c789843-6bd9-424e-903f-302e0c98d352"

        self       = <tekhsi.tek_hsi_connect.TekHSIConnect object at 0x7f7819088140>
.tox/tests/lib/python3.12/site-packages/grpc/_channel.py:1181: in __call__
    return _end_unary_response_blocking(state, call, False, None)
        call       = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7818e157c0>
        compression = None
        credentials = None
        metadata   = None
        request    = name: "8c789843-6bd9-424e-903f-302e0c98d352"

        self       = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f7818ec5b00>
        state      = <grpc._channel._RPCState object at 0x7f7818f6bb00>
        timeout    = None
        wait_for_ready = None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

state = <grpc._channel._RPCState object at 0x7f7818f6bb00>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7818e157c0>
with_call = False, deadline = None

    def _end_unary_response_blocking(
        state: _RPCState,
        call: cygrpc.SegregatedCall,
        with_call: bool,
        deadline: Optional[float],
    ) -> Union[ResponseType, Tuple[ResponseType, grpc.Call]]:
        if state.code is grpc.StatusCode.OK:
            if with_call:
                rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
                return state.response, rendezvous
            else:
                return state.response
        else:
>           raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
E           grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E           	status = StatusCode.FAILED_PRECONDITION
E           	details = ""
E           	debug_error_string = "UNKNOWN:Error received from peer ipv6:%5B::1%5D:50312 {grpc_message:"", grpc_status:9, created_time:"2025-04-18T16:20:46.497537315+00:00"}"
E           >

call       = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7818e157c0>
deadline   = None
state      = <grpc._channel._RPCState object at 0x7f7818f6bb00>
with_call  = False

.tox/tests/lib/python3.12/site-packages/grpc/_channel.py:1006: _InactiveRpcError

Link to workflow run

Copy link

github-actions bot commented Apr 18, 2025

Test Results (macos)

path passed subtotal
tests/test_client.py 62 62
tests/test_logging.py 3 3
TOTAL 65 65

Link to workflow run

Copy link

github-actions bot commented Apr 18, 2025

Test Results (windows)

path passed subtotal
tests\test_client.py 62 62
tests\test_logging.py 3 3
TOTAL 65 65

Link to workflow run

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