pcdshub / happi

Heuristic Access to Positions of Photon Instruments
https://pcdshub.github.io/happi/master
Other
13 stars 29 forks source link

ENH: happi config cli sub-commands #315

Closed untzag closed 1 year ago

untzag commented 1 year ago

Description

Adding new sub-command-group config to CLI.

Motivation and Context

See #314

How Has This Been Tested?

Tested on my machine.

Where Has This Been Documented?

CLI is auto-documented.

Pre-merge checklist

tangkong commented 1 year ago

Whoops, the failures from the test suite are coming from the way I assumed the context would be loaded. Sorry, I didn't realize this refactor would be so involved. The change needed is pretty quick though: Also use the happi_cfg fixture and pass that in as the obj in any cli test.

An Example:

def test_search(client: happi.client.Client, happi_cfg: str):
    res = client.search_regex(beamline="TST")

    with search.make_context('search', ['beamline=TST'], obj=happi_cfg) as ctx:
        res_cli = search.invoke(ctx)

    assert [r.item for r in res] == [r.item for r in res_cli]

I can push some changes real quick