pgcentralfoundation / pgrx

Build Postgres Extensions with Rust!
Other
3.55k stars 237 forks source link

Can't run individual tests #1839

Open ccleve opened 1 week ago

ccleve commented 1 week ago

This might not be a bug. It might be that I just can't find the magic syntax.

cargo pgrx new foop
cd foop
cargo pgrx test

<snip>

test tests::pg_test_hello_foop ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 22.65s
cargo pgrx test test_hello_foop
Error: 
   0: Postgres `test_hello_foop` is not managed by pgrx

cargo pgrx test hello_foop 
Error: 
   0: Postgres `hello_foop` is not managed by pgrx

cargo pgrx test pg_test_hello_foop
Error: 
   0: Postgres `pg_test_hello_foop` is not managed by pgrx

cargo pgrx test tests::pg_test_hello_foop
Error: 
   0: Postgres `tests::pg_test_hello_foop` is not managed by pgrx

cargo pgrx test tests.test_hello_foop
Error: 
   0: Postgres `tests.test_hello_foop` is not managed by pgrx

I think this used to work, but I haven't tried it in a long time.

I'm using 0.12.1.

eeeebbbbrrrr commented 1 week ago

you need to specify the Postgres version before the specific test name.

I’m not sure if we’ve ever been smart about this or not. I suppose we could.

ccleve commented 1 week ago

Ayup. That did it.

If I get ambitious here, I'll fix the docs, and maybe default the pg version param, and maybe add some way of passing through switches to cargo test. Yesterday I found it very helpful to be able to add --test-threads 1. Anything else that needs doing while I'm in there?

workingjubilee commented 1 week ago

and maybe add some way of passing through switches to cargo test.

typically the pattern for that is -- and then whatever else passed through after (I don't know if we currently respect that pattern)