Skip to content

Commit 58bbe3f

Browse files
committed
agent: Add AGENTS.md
1 parent 6cc0755 commit 58bbe3f

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

‎AGENTS.md‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## Rule
2+
3+
Do `ruff format` and `ruff check` before commit.
4+
5+
## Running the MySQL test suite in this container
6+
7+
1. Install the server and test dependencies if they are not already available:
8+
9+
```sh
10+
apt-get update
11+
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server
12+
python -m pip install --upgrade -r requirements-dev.txt
13+
```
14+
15+
2. Keep MySQL running in a separate, long-lived terminal/session. The container
16+
does not run systemd, so start `mysqld` directly instead of using
17+
`systemctl`:
18+
19+
```sh
20+
install -d -o mysql -g mysql /run/mysqld
21+
rm -f /run/mysqld/mysqld.sock /run/mysqld/mysqld.sock.lock \
22+
/run/mysqld/mysqlx.sock /run/mysqld/mysqlx.sock.lock \
23+
/run/mysqld/mysqld.pid
24+
mysqld --user=mysql --local-infile=1 \
25+
--socket=/run/mysqld/mysqld.sock \
26+
--pid-file=/run/mysqld/mysqld.pid
27+
```
28+
29+
3. In another terminal/session, wait for MySQL and initialize a fresh data
30+
directory. The SQL files create databases and users, so only run them when
31+
`test1` does not exist:
32+
33+
```sh
34+
until mysqladmin ping --silent; do sleep 1; done
35+
if ! mysql -NBe "SHOW DATABASES LIKE 'test1'" | rg -q '^test1$'; then
36+
mysql -uroot --comments < ci/docker-entrypoint-initdb.d/init.sql
37+
mysql -uroot --comments < ci/docker-entrypoint-initdb.d/mysql.sql
38+
mysql -uroot --comments < ci/docker-entrypoint-initdb.d/mariadb.sql
39+
fi
40+
cp ci/docker.json pymysql/tests/databases.json
41+
```
42+
43+
4. Run the same test commands as CI:
44+
45+
```sh
46+
pytest -v --cov --cov-config .coveragerc pymysql
47+
pytest -v --cov-append --cov-config .coveragerc \
48+
--doctest-modules pymysql/converters.py
49+
```

0 commit comments

Comments
 (0)