Repository: facebookincubator/dcrpm (language: python)

Issue:
test_rpmdb_centos7_missing_index fails when building dcrpm with setuptools 60.9.3 in Fedora
Hello,
I'm working on integrating setuptools 60+ to Fedora and test it against all packages in Fedora Rawhide (the rebuild takes place in [Copr repository](https://copr.fedorainfracloud.org/coprs/ksurma/setuptools-60/package/python-dcrpm/). One of the big-impact changes is the new default: setuptools uses its own distutils (rather than the one from Python's standard library).
One of dcrpm's tests fails every time with the newest setuptools and builds successfully every time with setuptools 59.6.0 we already have in Fedora. The test failure is rather weird though, there's no clear (to me) connection to setuptools that could play any role here.  Do you have any idea why does this happen?

```console
FAIL: test_rpmdb_centos7_missing_index (tests.test_end_to_end.DcrpmIntegrationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/dcrpm-0.6.2/tests/rpmdb.py", line 38, in wrapper
    result = t.cast(F, function)(*args, **kwargs)
  File "/builddir/build/BUILD/dcrpm-0.6.2/tests/test_end_to_end.py", line 92, in test_rpmdb_centos7_missing_index
    self.assertEqual(self.action_trace(), [])
AssertionError: Lists differ: ['index_rebuild', 'index_rebuild', 'table_rebuild'] != []

First list contains 3 additional elements.
First extra element 0:
'index_rebuild'

- ['index_rebuild', 'index_rebuild', 'table_rebuild']
+ []

----------------------------------------------------------------------
Ran 67 tests in 7.490s

FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=67 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=67 errors=0 failures=1>
```


Discussion / hints:
@befeleme could you file this in Bugzilla too? (I comaintain `python-dcrpm` there).

It's a weird error indeed - I'll take a look
Filed https://bugzilla.redhat.com/show_bug.cgi?id=2071821 to track since it still reproduces (`fedpkg scratch-build` after `fedpkg clone python-dcrm`)

Fix patch:
diff --git a/README.md b/README.md
index ffddbff..56666a6 100644
--- a/README.md
+++ b/README.md
@@ -33,9 +33,7 @@ If you want to develop, the easiest way to get dcrpm is by using pip:
 
 When developing it's important to make sure the tests continue to pass, and to ensure new features have the appropriate test coverage. You can run the test suite with:
 
-    python setup.py test
-
-which will fetch mock from pypi if needed and then run the tests.
+    pytest
 
 ## Contribute
 See the CONTRIBUTING file for how to help out.
diff --git a/requirements.txt b/requirements.txt
index ef9caf6..dff9f9a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,6 @@
 mock; python_version < '3.6'
 psutil
+pytest
 typing; python_version < '3.6'
 TestSlide==1.4.10; python_version < '3.5'
 TestSlide; python_version >= '3.5'


Test patch:
diff --git a/tests/test_util.py b/tests/test_util.py
index b7748a5..43e5bf4 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -45,7 +45,9 @@ def make_mock_popen(
     Creates a simple mocked Popen object that responds to Popen.poll and
     Popen.communicate.
     """
-    mock_popen_obj = Mock()
+
+    # set PID because this is used by pytest's logging.py
+    mock_popen_obj = Mock(pid=42)
     config = {"poll.return_value": returncode}  # type: t.Dict[str, t.Any]
     if communicate_raise:
         config["communicate.side_effect"] = TimeoutExpired()