standardbots 2.20250128.39__tar.gz → 2.20250417.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of standardbots might be problematic. Click here for more details.
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/PKG-INFO +1 -1
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/README.md +68 -9
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/setup.py +1 -1
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/standardbots/auto_generated/apis.py +927 -65
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/standardbots/auto_generated/models.py +1569 -75
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/standardbots.egg-info/PKG-INFO +1 -1
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/standardbots.egg-info/SOURCES.txt +1 -0
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/tests/fixtures/client_fixt.py +0 -2
- standardbots-2.20250417.1/tests/fixtures/robot_fixt.py +49 -0
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/tests/fixtures/routines_fixt.py +23 -0
- standardbots-2.20250417.1/tests/test_apis.py +3380 -0
- standardbots-2.20250128.39/tests/test_apis.py +0 -1294
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/setup.cfg +0 -0
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/standardbots/__init__.py +0 -0
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/standardbots/auto_generated/__init__.py +0 -0
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/standardbots.egg-info/dependency_links.txt +0 -0
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/standardbots.egg-info/requires.txt +0 -0
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/standardbots.egg-info/top_level.txt +0 -0
- {standardbots-2.20250128.39 → standardbots-2.20250417.1}/tests/fixtures/__init__.py +0 -0
|
@@ -20,15 +20,40 @@ To run a script move into the `sdks/python` folder and run `python playground/fi
|
|
|
20
20
|
|
|
21
21
|
# Tests
|
|
22
22
|
|
|
23
|
+
## `botctl` commands
|
|
24
|
+
|
|
25
|
+
You may now use the `botctl` commands to setup and run tests.
|
|
26
|
+
|
|
27
|
+
Set up the testing environment on the computer where you are running the tests:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Setup testing environment
|
|
31
|
+
botctl publicapi test:setup --help
|
|
32
|
+
|
|
33
|
+
# Run tests
|
|
34
|
+
botctl publicapi test --help
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Set up the bot environment on the robot:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
botctl publicapi test:setup-bot
|
|
41
|
+
```
|
|
42
|
+
|
|
23
43
|
## Setup
|
|
24
44
|
|
|
25
45
|
To set up tests:
|
|
26
46
|
|
|
27
47
|
```bash
|
|
28
48
|
cd sdks/python
|
|
49
|
+
```
|
|
29
50
|
|
|
30
|
-
|
|
31
|
-
|
|
51
|
+
Note: Make sure to select proper python interpreter.
|
|
52
|
+
Sometimes there is an error related to missing "dotenv" module, to solve this install it separately
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
python3 -m pip install python-dotenv
|
|
56
|
+
python3 -m pip install -r requirements-dev.txt
|
|
32
57
|
```
|
|
33
58
|
|
|
34
59
|
### Create sample data
|
|
@@ -71,7 +96,7 @@ python3 -m pytest ./tests --cov=standardbots
|
|
|
71
96
|
|
|
72
97
|
### Robot state and testing (Markers)
|
|
73
98
|
|
|
74
|
-
We need the bot to be in a certain state to run certain tests. For example, we need a routine to be running in order to stop the routine.
|
|
99
|
+
We need the bot to be in a certain state to run certain tests. For example, we need a routine to be running in order to stop the routine. Camera should be connected by default.
|
|
75
100
|
|
|
76
101
|
At start of testing, robot should:
|
|
77
102
|
|
|
@@ -81,19 +106,23 @@ At start of testing, robot should:
|
|
|
81
106
|
The basic idea here is:
|
|
82
107
|
|
|
83
108
|
- These special tests will not be run by default.
|
|
84
|
-
- You may pass a flag (e.g. `--
|
|
85
|
-
-
|
|
109
|
+
- You may pass a flag (e.g. `--camera-disconnected`) when the bot is in the correct state to run the tests.
|
|
110
|
+
- Markers usage:
|
|
111
|
+
- When `--gripper=<type>` flag is passed(`type` is value from `GripperKindEnum` enum):
|
|
112
|
+
1. Tests expect that this specific gripper is connected
|
|
113
|
+
2. Tests without the flag are not run.
|
|
114
|
+
- When `--camera-disconnected` flag is passed:
|
|
86
115
|
1. Tests with the flag are run.
|
|
87
116
|
2. Tests without the flag are not run.
|
|
88
117
|
|
|
89
118
|
We use [pytest markers](https://docs.pytest.org/en/7.1.x/example/markers.html) to do this.
|
|
90
119
|
|
|
91
|
-
####
|
|
120
|
+
#### Camera disconnected
|
|
92
121
|
|
|
93
|
-
The
|
|
122
|
+
The wrist camera should be disabled. Then run:
|
|
94
123
|
|
|
95
124
|
```bash
|
|
96
|
-
python3 -m pytest ./tests --cov=standardbots --
|
|
125
|
+
python3 -m pytest ./tests --cov=standardbots --camera-disconnected
|
|
97
126
|
```
|
|
98
127
|
|
|
99
128
|
#### E-stop
|
|
@@ -137,5 +166,35 @@ To test custom sensors:
|
|
|
137
166
|
Then run:
|
|
138
167
|
|
|
139
168
|
```bash
|
|
140
|
-
python3 -m pytest ./tests --cov=standardbots --
|
|
169
|
+
python3 -m pytest ./tests --cov=standardbots --gripper=custom_sensors
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Database backups
|
|
173
|
+
|
|
174
|
+
> See command: `botctl publicapi test:setup-bot`.
|
|
175
|
+
|
|
176
|
+
We now have a common robot database state that can be used for testing. While this isn't necessary for use, it does provide a common state for testing.
|
|
177
|
+
|
|
178
|
+
### How to create a new backup
|
|
179
|
+
|
|
180
|
+
In the place where you are running the stack and want to create the backup (e.g. on the control box):
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
DB_USER=sb
|
|
184
|
+
DB_NAME=sb
|
|
185
|
+
BACKUP_FILE=$HOME/db-backup-publicapi-test.sql
|
|
186
|
+
|
|
187
|
+
docker exec -it postgres-bot pg_dump -U $DB_USER -d $DB_NAME -F c -f /tmp/backup.sql
|
|
188
|
+
|
|
189
|
+
docker cp postgres-bot:/tmp/backup.sql $BACKUP_FILE
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
If you need to download to the actual development environment:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
CB_FILE=/home/control-box-bot/db-backup-publicapi-test.sql
|
|
196
|
+
VM_FILE=~/sb/golang/apps/botctl/commands/publicapi/db-backup-publicapi-test.sql
|
|
197
|
+
|
|
198
|
+
# Move directly to VM:
|
|
199
|
+
scp cb2047:$CB_FILE $VM_FILE
|
|
141
200
|
```
|