Repository: meltano/meltano

Issue:
Upgrade pytest
Migrated from GitLab: https://gitlab.com/meltano/meltano/-/issues/3529

Originally created by @vischous on 2022-05-25 20:11:16

---

While waiting for some tests to run I was trying to speed up my iteration time, and found `pytest-xdist`. 
Thread here https://meltano.slack.com/archives/CKHP6G5V4/p1653508630941889

I have a version of pytest-xdist that should work with our version of pytest so I'm good, but we do have an old version of Pytest and I told @WillDaSilva I'd throw an issue in :D 

```
PS E:\code\meltano> poetry add -D pytest-xdist
Using version ^2.5.0 for pytest-xdist

Updating dependencies
Resolving dependencies...

  SolverProblemError

  Because no versions of pytest-xdist match >2.5.0,<3.0.0
   and pytest-xdist (2.5.0) depends on pytest (>=6.2.0), pytest-xdist (>=2.5.0,<3.0.0) requires pytest (>=6.2.0).
  So, because meltano depends on both pytest (^4.3.1) and pytest-xdist (^2.5.0), version solving failed.

  at ~\.poetry\lib\poetry\puzzle\solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes
```


Discussion:

Resolving patch:
diff --git a/src/meltano/core/plugin/superset.py b/src/meltano/core/plugin/superset.py
--- a/src/meltano/core/plugin/superset.py
+++ b/src/meltano/core/plugin/superset.py
@@ -68,7 +68,7 @@ async def before_configure(self, invoker: SupersetInvoker, session):  # noqa: WP
         config_script_lines = [
             "import sys",
             "module = sys.modules[__name__]",
-            f"config = {str(config)}",
+            f"config = {config!r}",
             "for key, value in config.items():",
             "    if key.isupper():",
             "        setattr(module, key, value)",


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -12,17 +12,17 @@ jobs:
     strategy:
       matrix:
         include:
-        - { python-version: "3.7",  os: "ubuntu-latest", backend-db: sqlite }
-        - { python-version: "3.8",  os: "ubuntu-latest", backend-db: sqlite }
-        - { python-version: "3.9",  os: "ubuntu-latest", backend-db: sqlite }
-        - { python-version: "3.10", os: "ubuntu-latest", backend-db: sqlite }
-        - { python-version: "3.7",  os: "ubuntu-latest", backend-db: postgresql }
-        - { python-version: "3.8",  os: "ubuntu-latest", backend-db: postgresql }
-        - { python-version: "3.9",  os: "ubuntu-latest", backend-db: postgresql }
-        - { python-version: "3.10", os: "ubuntu-latest", backend-db: postgresql }
-        - { python-version: "3.7", os: "windows-latest", backend-db: sqlite } # We'd like to run Windows tests for all backend-dbs see https://github.com/meltano/meltano/issues/6281
-        - { python-version: "3.8", os: "windows-latest", backend-db: sqlite }
-        - { python-version: "3.9", os: "windows-latest", backend-db: sqlite }
+        - { python-version: "3.7",  os: "ubuntu-latest",  backend-db: sqlite }
+        - { python-version: "3.8",  os: "ubuntu-latest",  backend-db: sqlite }
+        - { python-version: "3.9",  os: "ubuntu-latest",  backend-db: sqlite }
+        - { python-version: "3.10", os: "ubuntu-latest",  backend-db: sqlite }
+        - { python-version: "3.7",  os: "ubuntu-latest",  backend-db: postgresql }
+        - { python-version: "3.8",  os: "ubuntu-latest",  backend-db: postgresql }
+        - { python-version: "3.9",  os: "ubuntu-latest",  backend-db: postgresql }
+        - { python-version: "3.10", os: "ubuntu-latest",  backend-db: postgresql }
+        - { python-version: "3.7",  os: "windows-latest", backend-db: sqlite } # We'd like to run Windows tests for all backend-dbs see https://github.com/meltano/meltano/issues/6281
+        - { python-version: "3.8",  os: "windows-latest", backend-db: sqlite }
+        - { python-version: "3.9",  os: "windows-latest", backend-db: sqlite }
         - { python-version: "3.10", os: "windows-latest", backend-db: sqlite }
       fail-fast: false
 
diff --git a/.gitlab/ci/test.gitlab-ci.yml b/.gitlab/ci/test.gitlab-ci.yml
--- a/.gitlab/ci/test.gitlab-ci.yml
+++ b/.gitlab/ci/test.gitlab-ci.yml
@@ -54,14 +54,7 @@ lint_eslint:
 .pytest:
   extends: .test
   script:
-    - poetry run pytest -v --cov-report= --cov meltano -m "$PYTEST_MARKERS"
-    - poetry run coverage combine .coverage
-    - poetry run coverage report
-    - poetry run coverage html
-  artifacts:
-    paths:
-      - htmlcov/
-    when: on_success
+    - poetry run pytest -v -m "$PYTEST_MARKERS"
 
 .pytest_postgres:
   extends: .pytest