https://pantsbuild.org/ logo
#general
Title
# general
r

ripe-gigabyte-88964

05/04/2023, 5:54 PM
Hey all, we've got 2 projects in our monorepo that each have a config file with the same name. In our unit tests we relocate that config file to the sandbox directory using the
relocated_files
goal. However, the coverage plugin is failing now due to the following intrinsic error:
Copy code
IntrinsicError: Can only merge Directories with no duplicates, but found 2 duplicate entries in :
This seems to be the problematic source code in question. Is this a legitimate bug or is there a way around this issue?
b

broad-processor-92400

05/04/2023, 8:48 PM
Could you share the relevant parts of your BUILD files?
r

ripe-gigabyte-88964

05/04/2023, 8:49 PM
Copy code
relocated_files(
    name="meltano_config",
    files_targets=[f"{build_file_dir().parent}:meltano_config"],
    src=str(build_file_dir().parent),
    dest="",
)  # this target copies meltano.yml to sandbox directory before the tests run

python_tests(
    dependencies=[":meltano_config"],
    # the extra env vars below are required because these tests will call the meltano CLI directly
    # this tells the PEX to export itself to a temporary venv and add that venv to the PATH variable
    # PEX environment variables reference: <https://pex.readthedocs.io/en/v2.1.135/api/vars.html>
    extra_env_vars=["PEX_VENV=1", "PEX_VENV_BIN_PATH=prepend"],
)
These same
BUILD
contents appear in a
tests
subdirectory in 2 projects in our repo.
b

broad-processor-92400

05/04/2023, 9:23 PM
Ah, and the
meltano
config needs to be in the root of the sandbox?
r

ripe-gigabyte-88964

05/04/2023, 9:23 PM
yep exactly
works perfectly except when it goes to collect test coverage
because multiple projects have a
meltano.yml
b

broad-processor-92400

05/04/2023, 9:26 PM
Frustrating! That does sound like a bug (pants shouldn't be getting in your way...), so please file one. Some work-arounds I can think of: ā€¢ disable coverage ā€¢ some way to leave the
meltano.yml
configs where they are, rather ending up with multiple in the root of the repo
r

ripe-gigabyte-88964

05/04/2023, 9:27 PM
Cool, I just wanted to confirm that was the case before filing my bug. Will do so first thing tomorrow. šŸ˜…