TST: Fixing bug in skipping db tests by default
Fixing bug introduced in #24492. Skipping db tests fails with `SyntaxError` when `pytest` `-m` parameter is not specified.

Reported in #24485#issuecomment-450600185
