[red-knot] Unify setup_db() functions, add TestDb builder (#14777)

## Summary

- Instead of seven (more or less similar) `setup_db` functions, use just
one in a single central place.
- For every test that needs customization beyond that, offer a
`TestDbBuilder` that can control the Python target version, custom
typeshed, and pre-existing files.

The main motivation for this is that we're soon going to need
customization of the Python version, and I didn't feel like adding this
to each of the existing `setup_db` functions.
This commit is contained in:
David Peter 2024-12-04 21:36:54 +01:00 committed by GitHub
parent 155d34bbb9
commit bd27bfab5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 116 additions and 200 deletions

View file

@ -90,7 +90,7 @@ impl<'db> Symbol<'db> {
#[cfg(test)]
mod tests {
use super::*;
use crate::types::tests::setup_db;
use crate::db::tests::setup_db;
#[test]
fn test_symbol_or_fall_back_to() {