diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml new file mode 100644 index 0000000..56c38b7 --- /dev/null +++ b/.github/workflows/pre_commit.yml @@ -0,0 +1,12 @@ +on: + pull_request: + push: + branches: [main, ui_tests] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/workflows.yml b/.github/workflows/tests.yml similarity index 55% rename from .github/workflows/workflows.yml rename to .github/workflows/tests.yml index d158cd0..b39049e 100644 --- a/.github/workflows/workflows.yml +++ b/.github/workflows/tests.yml @@ -1,18 +1,9 @@ -name: tests - on: pull_request: push: - branches: [main] + branches: [main, ui_tests] jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.1 - pytest: runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index a6fbd0f..f99c249 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Motor stage UI -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) ![Tests](https://github.com/SiLab-Bonn/motor_stage_ui/tree/ui_tests/.github/tests/badge.svg) ![pre-commit](https://github.com/SiLab-Bonn/motor_stage_ui/tree/ui_tests/.github/pre_commit/badge.svg) Offers both a terminal and graphical user interface for the [C-863 Mercury controller](https://www.le.infn.it/~chiodini/allow_listing/pi/Manuals/C-863_UserManual_MS205E200.pdf) (Check also the [commands](https://twiki.cern.ch/twiki/bin/viewfile/ILCBDSColl/Phase2Preparations?rev=1;filename=MercuryNativeCommands_MS176E101.pdf)). Motor stages can be arranged in daisy chains. @@ -58,3 +58,21 @@ The step size of a specific stage is given in um for translation stages and deg | `stop` | `Stop` | Immediately stops all movement of the stage | motor_name (str): name of the motorstage | - | | `sethome` | `Set Zero` | Sets the current position of the stage as new origin | motor_name (str): name of the motorstage | - | | `gohome` | `MV. Zero` | Goes to origin of the stage | motor_name (str): name of the motorstage | - | +| `status` | -` | Returns the status of the motor controller | motor_name (str): name of the motorstage | - | + +## Tests + +General UI tests, utilizing a motor controller mock, are performed when setting the environmental variable 'TEST' e.g.: + +```bash +TEST=True motor init x_axis +``` + +```bash +TEST=True motorgui +``` +Utilizing [pytest](https://docs.pytest.org/en/stable/) the mock tests the software. + +```bash +pytest -sv +```