-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from pathlib import Path | ||
import pytest | ||
from motor_stage_ui.motor_stage_gui import MainWindow | ||
from motor_stage_ui.test.utils import SerialInterfaceMock | ||
from PyQt5 import QtCore | ||
|
||
FILEPATH = Path(__file__).parent | ||
CONFIG_FILE = FILEPATH / "test_configuration.yaml" | ||
|
||
INTERFACE = SerialInterfaceMock | ||
|
||
|
||
@pytest.fixture | ||
def app(qtbot): | ||
motor_gui = MainWindow(CONFIG_FILE, interface=INTERFACE) | ||
return motor_gui | ||
|
||
|
||
def test_init_clicked(app): | ||
app.mouseClick(app.init_clicked, app.QtCore.Qt.MouseButton.LeftButton) | ||
assert app.motor.serial_interface._serial_commands[-3:] == [ | ||
b"\x010MN\r", | ||
b"\x010RT\r", | ||
b"\x010SV200000\r", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from click.testing import CliRunner | ||
import motor_stage_ui.motor_stage_terminal as terminal_ui | ||
|
||
|
||
def test_motor(): | ||
runner = CliRunner() | ||
runner.invoke(terminal_ui.motor) | ||
|
||
|
||
def test_init(): | ||
runner = CliRunner() | ||
runner.invoke(terminal_ui.init) | ||
|
||
|
||
def test_gohome(): | ||
runner = CliRunner() | ||
runner.invoke(terminal_ui.gohome, ["x_axis"]) | ||
|
||
|
||
def test_pos(): | ||
runner = CliRunner() | ||
runner.invoke(terminal_ui.pos, ["x_axis"]) | ||
|
||
|
||
def test_move(): | ||
runner = CliRunner() | ||
runner.invoke(terminal_ui.move, ["-a 3cm x_axis"]) |