crooked-tent-69497
02/06/2020, 5:25 PMpsutil.Popen('./pants run {target}', shell=True) and
psutil.Popen([os.getcwd() + '/pants', 'run', '{target}'])hundreds-father-404
02/06/2020, 5:26 PMpsutil.Popen. Once you get that working, then switch to psutil.Popen
Here, psutil.Popen is a little distracting from the underlying issuecrooked-tent-69497
02/06/2020, 5:27 PMdry-analyst-73584
02/06/2020, 5:27 PMException: ModuleNotFoundError("No module named '__pants_backend_python_tasks_pytest_prep_coverage_plugin__'",)
error happening within your subprocess, or just during the test which uses the subprocess?crooked-tent-69497
02/06/2020, 5:29 PM$COVERAGE_PROCESS_START and then in my initialization routine invoke coverage.process_startup()), but I can try that again and see what happenshundreds-father-404
02/06/2020, 5:30 PMare you suggesting i try to run coverage on the executable manually ?I mean try running
./pants run target directly on the command line. Is that working? If so, but it doesn’t work with subprocess.Popen, then we know the issue has something to do with subprocess.Popen rather than an underlying issue with the call to Pantscrooked-tent-69497
02/06/2020, 5:31 PMdry-analyst-73584
02/06/2020, 5:31 PMcrooked-tent-69497
02/06/2020, 5:32 PM./pants run , I believe coverage doesn’t get invokeddry-analyst-73584
02/06/2020, 5:32 PM./pants run target inside of a test?dry-analyst-73584
02/06/2020, 5:33 PMcrooked-tent-69497
02/06/2020, 5:33 PMcrooked-tent-69497
02/06/2020, 5:34 PMcrooked-tent-69497
02/06/2020, 5:34 PM./pants run to the executable it creates ?crooked-tent-69497
02/06/2020, 5:35 PMdry-analyst-73584
02/06/2020, 5:35 PMcrooked-tent-69497
02/06/2020, 5:35 PMcrooked-tent-69497
02/06/2020, 5:35 PMcrooked-tent-69497
02/06/2020, 5:36 PMcrooked-tent-69497
02/06/2020, 5:37 PMcrooked-tent-69497
02/06/2020, 5:38 PMdry-analyst-73584
02/06/2020, 5:39 PMdry-analyst-73584
02/06/2020, 5:40 PM./pants run target , which explains the "No module named '__pants_backend_python_tasks_pytest_prep_coverage_plugin__'" errordry-analyst-73584
02/06/2020, 5:41 PMcrooked-tent-69497
02/06/2020, 5:44 PM[GLOBAL]
pants_version: 1.21.0
plugins: +[
"pantsbuild.pants.contrib.node==%(pants_version)s",
"pantsbuild.pants.contrib.python.checks==%(pants_version)s",
"pantsbuild.pants.contrib.mypy==%(pants_version)s",
"pylint==1.9.3",
]
I’ve tried setting packages here (had run into a no module coverage issue, and if i include it here it seems to work)
and here -
[DEFAULT]
[pytest]
requirements: pytest==3.6.4
cov_requirements: pytest-cov==2.5.1crooked-tent-69497
02/06/2020, 5:44 PMcrooked-tent-69497
02/06/2020, 5:46 PMcrooked-tent-69497
02/06/2020, 5:46 PMcrooked-tent-69497
02/06/2020, 5:49 PMdry-analyst-73584
02/06/2020, 5:51 PMdry-analyst-73584
02/06/2020, 5:51 PMcrooked-tent-69497
02/06/2020, 5:55 PMcrooked-tent-69497
02/06/2020, 5:56 PMcrooked-tent-69497
02/06/2020, 5:56 PMcrooked-tent-69497
02/06/2020, 6:00 PMcrooked-tent-69497
02/06/2020, 6:00 PMpytest-cov: Failed to setup subprocess coverage. Environ: {'COV_CORE_SOURCE': 'modules:cc:cc.imagen_cc.devices.middleware:cc.imagen_cc.devices.lib:<http://cc.imagen_cc.devices.cc|cc.imagen_cc.devices.cc>', 'COV_CORE_CONFIG': '/Users/sameermoidu/code/mordor/.pants.d/test/pytest/cc.imagen_test.devices.middleware.test_e2e/tmp9bgkk2hp', 'COV_CORE_DATAFILE': '/Users/sameermoidu/code/mordor/.coverage'} Exception: ModuleNotFoundError("No module named '__pants_backend_python_tasks_pytest_prep_coverage_plugin__'",)dry-analyst-73584
02/06/2020, 6:02 PM--pytest-version=<str> and --pytest-pytest-plugins=<str> BUT: these things are only available when you are running ./pants test they are not available in the environment when you ./pants rundry-analyst-73584
02/06/2020, 6:03 PMcrooked-tent-69497
02/06/2020, 6:04 PMdry-analyst-73584
02/06/2020, 6:04 PMcrooked-tent-69497
02/06/2020, 6:04 PMcrooked-tent-69497
02/06/2020, 6:04 PMcrooked-tent-69497
02/06/2020, 6:05 PMdry-analyst-73584
02/06/2020, 6:05 PM./pants run from within your integration test you may get the behavior you're looking for.crooked-tent-69497
02/06/2020, 6:05 PMhappy-kitchen-89482
02/06/2020, 6:21 PM./pants run and you want to run coverage on that ./pants run invocation?crooked-tent-69497
02/06/2020, 6:22 PMhappy-kitchen-89482
02/06/2020, 6:22 PM./pants test but setting up coverage manually yourself in your ./pants run invocationcrooked-tent-69497
02/06/2020, 6:23 PMhappy-kitchen-89482
02/06/2020, 6:23 PM./pants test coverage?crooked-tent-69497
02/06/2020, 6:23 PMhappy-kitchen-89482
02/06/2020, 6:23 PMhappy-kitchen-89482
02/06/2020, 6:24 PMcrooked-tent-69497
02/06/2020, 6:24 PMhappy-kitchen-89482
02/06/2020, 6:24 PM./pants test pick it up and merge it into the test's coverage? Is that an accurate representation of the problem?crooked-tent-69497
02/06/2020, 6:25 PMhappy-kitchen-89482
02/06/2020, 6:25 PMhappy-kitchen-89482
02/06/2020, 6:25 PMcrooked-tent-69497
02/06/2020, 6:25 PMcrooked-tent-69497
02/06/2020, 6:25 PMhappy-kitchen-89482
02/06/2020, 6:25 PMcrooked-tent-69497
02/06/2020, 6:26 PMcrooked-tent-69497
02/06/2020, 6:26 PMhappy-kitchen-89482
02/06/2020, 6:26 PMhappy-kitchen-89482
02/06/2020, 6:26 PM.pants.d somewherecrooked-tent-69497
02/06/2020, 6:26 PMcrooked-tent-69497
02/06/2020, 6:26 PMcrooked-tent-69497
02/06/2020, 6:27 PMhappy-kitchen-89482
02/06/2020, 6:27 PMcrooked-tent-69497
02/06/2020, 6:27 PMhappy-kitchen-89482
02/06/2020, 6:30 PMdry-analyst-73584
02/06/2020, 6:31 PMcoverage combine on .coverage files will delete the .coverage files. I suggest copying them to some other location before doing your mergecrooked-tent-69497
02/06/2020, 6:31 PMcrooked-tent-69497
02/06/2020, 6:32 PMdry-analyst-73584
02/06/2020, 6:32 PMcrooked-tent-69497
02/06/2020, 8:25 PM./pants test {target} — --cov=targetdir -- pretty much nothing is recorded (init files are 100% and everything else is more or less 0)
Then, I switched to trying to supply coverage targets via --test-pytest-coverage=modules:, and then frequently modules that I know for a fact are included don’t get any hits.
Any guidance on the best approach here ?crooked-tent-69497
02/06/2020, 8:33 PM--coverage=modules:path.inner.module_1,path.inner.module_2 vs --coverage=modules:path.inner produces different results