Skip to content

Commit 0b13bc9

Browse files
committed
Adjust tests for Python 3.13
And use this version in CI. Also adjust the sample output of --help in README.
1 parent af9eb04 commit 0b13bc9

File tree

4 files changed

+106
-17
lines changed

4 files changed

+106
-17
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ jobs:
1010
include:
1111
- python: "3.9"
1212
psycopg: "psycopg2"
13-
- python: "3.12"
13+
- python: "3.13"
1414
psycopg: "psycopg3"
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Setup Python
1818
uses: actions/setup-python@v5
1919
with:
2020
python-version: ${{ matrix.python }}
21+
allow-prereleases: true
2122
- name: Install tox
2223
run: pip install tox
2324
- name: Add fr_FR and zh_TW for test purposes

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ ex:
8787
pg_activity [options] [connection string]
8888

8989
Configuration:
90-
-P PROFILE, --profile PROFILE
90+
-P, --profile PROFILE
9191
Configuration profile matching a PROFILE.conf file in
9292
${XDG_CONFIG_HOME:~/.config}/pg_activity/ or
9393
/etc/pg_activity/, or a built-in profile.
@@ -123,13 +123,11 @@ ex:
123123
Connection Options:
124124
connection string A valid connection string to the database, e.g.:
125125
'host=HOSTNAME port=PORT user=USER dbname=DBNAME'.
126-
-h HOSTNAME, --host HOSTNAME
127-
Database server host or socket directory.
128-
-p PORT, --port PORT Database server port.
129-
-U USERNAME, --username USERNAME
126+
-h, --host HOSTNAME Database server host or socket directory.
127+
-p, --port PORT Database server port.
128+
-U, --username USERNAME
130129
Database user name.
131-
-d DBNAME, --dbname DBNAME
132-
Database name to connect to.
130+
-d, --dbname DBNAME Database name to connect to.
133131

134132
Process table display options:
135133
These options may be used hide some columns from the processes table.

tests/test_cli_help.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
>>> import sys
22
>>> import pytest
3-
>>> if sys.version_info < (3, 9):
4-
... pytest.skip("only applies for Python version >= 3.9")
3+
>>> if sys.version_info < (3, 13):
4+
... pytest.skip("only applies for Python version >= 3.13")
55
...
66

77
>>> from pgactivity import cli
@@ -12,7 +12,7 @@ usage: pytest [options] [connection string]
1212
htop like application for PostgreSQL server activity monitoring.
1313
<BLANKLINE>
1414
Configuration:
15-
-P PROFILE, --profile PROFILE
15+
-P, --profile PROFILE
1616
Configuration profile matching a PROFILE.conf file in
1717
${XDG_CONFIG_HOME:~/.config}/pg_activity/ or
1818
/etc/pg_activity/, or a built-in profile.
@@ -48,13 +48,11 @@ Options:
4848
Connection Options:
4949
connection string A valid connection string to the database, e.g.:
5050
'host=HOSTNAME port=PORT user=USER dbname=DBNAME'.
51-
-h HOSTNAME, --host HOSTNAME
52-
Database server host or socket directory.
53-
-p PORT, --port PORT Database server port.
54-
-U USERNAME, --username USERNAME
51+
-h, --host HOSTNAME Database server host or socket directory.
52+
-p, --port PORT Database server port.
53+
-U, --username USERNAME
5554
Database user name.
56-
-d DBNAME, --dbname DBNAME
57-
Database name to connect to.
55+
-d, --dbname DBNAME Database name to connect to.
5856
<BLANKLINE>
5957
Process table display options:
6058
These options may be used hide some columns from the processes table.

tests/test_cli_help_py312.txt

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
>>> import sys
2+
>>> import pytest
3+
>>> if sys.version_info >= (3, 13):
4+
... pytest.skip("only applies for Python version < 3.13")
5+
...
6+
7+
>>> from pgactivity import cli
8+
>>> parser = cli.get_parser()
9+
>>> parser.print_help()
10+
usage: pytest [options] [connection string]
11+
<BLANKLINE>
12+
htop like application for PostgreSQL server activity monitoring.
13+
<BLANKLINE>
14+
Configuration:
15+
-P PROFILE, --profile PROFILE
16+
Configuration profile matching a PROFILE.conf file in
17+
${XDG_CONFIG_HOME:~/.config}/pg_activity/ or
18+
/etc/pg_activity/, or a built-in profile.
19+
<BLANKLINE>
20+
Options:
21+
--blocksize BLOCKSIZE
22+
Filesystem blocksize (default: 4096).
23+
--rds Enable support for AWS RDS (implies --no-tempfiles and
24+
filters out the rdsadmin database from space
25+
calculation).
26+
--output FILEPATH Store running queries as CSV.
27+
--db-size, --no-db-size
28+
Enable/disable total size of DB.
29+
--tempfiles, --no-tempfiles
30+
Enable/disable tempfile count and size.
31+
--walreceiver, --no-walreceiver
32+
Enable/disable walreceiver checks.
33+
-w, --wrap-query Wrap query column instead of truncating.
34+
--duration-mode DURATION_MODE
35+
Duration mode. Values: 1-QUERY(default),
36+
2-TRANSACTION, 3-BACKEND.
37+
--min-duration SECONDS
38+
Don't display queries with smaller than specified
39+
duration (in seconds).
40+
--filter FIELD:REGEX Filter activities with a (case insensitive) regular
41+
expression applied on selected fields. Known fields
42+
are: dbname.
43+
--debug-file DEBUG_FILE
44+
Enable debug and write it to DEBUG_FILE.
45+
--version show program's version number and exit.
46+
--help Show this help message and exit.
47+
<BLANKLINE>
48+
Connection Options:
49+
connection string A valid connection string to the database, e.g.:
50+
'host=HOSTNAME port=PORT user=USER dbname=DBNAME'.
51+
-h HOSTNAME, --host HOSTNAME
52+
Database server host or socket directory.
53+
-p PORT, --port PORT Database server port.
54+
-U USERNAME, --username USERNAME
55+
Database user name.
56+
-d DBNAME, --dbname DBNAME
57+
Database name to connect to.
58+
<BLANKLINE>
59+
Process table display options:
60+
These options may be used hide some columns from the processes table.
61+
<BLANKLINE>
62+
--pid, --no-pid Enable/disable PID.
63+
--database, --no-database
64+
Enable/disable DATABASE.
65+
--user, --no-user Enable/disable USER.
66+
--client, --no-client
67+
Enable/disable CLIENT.
68+
--cpu, --no-cpu Enable/disable CPU%.
69+
--mem, --no-mem Enable/disable MEM%.
70+
--read, --no-read Enable/disable READ/s.
71+
--write, --no-write Enable/disable WRITE/s.
72+
--time, --no-time Enable/disable TIME+.
73+
--wait, --no-wait Enable/disable W.
74+
--app-name, --no-app-name
75+
Enable/disable APP.
76+
<BLANKLINE>
77+
Header display options:
78+
--no-inst-info Hide instance information.
79+
--no-sys-info Hide system information.
80+
--no-proc-info Hide workers process information.
81+
<BLANKLINE>
82+
Other display options:
83+
--hide-queries-in-logs
84+
Disable log_min_duration_statements and
85+
log_min_duration_sample for pg_activity.
86+
--refresh REFRESH Refresh rate. Values: 0.5, 1, 2, 3, 4, 5 (default: 2).
87+
<BLANKLINE>
88+
The connection string can be in the form of a list of Key/Value parameters or
89+
an URI as described in the PostgreSQL documentation. The parsing is delegated
90+
to the libpq: different versions of the client library may support different
91+
formats or parameters (for example, connection URIs are only supported from
92+
libpq 9.2).

0 commit comments

Comments
 (0)