Skip to content

fix: Use os.path.join for path construction in folder_searcher#718

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/pathlib-typeerror-frozen-env
Open

fix: Use os.path.join for path construction in folder_searcher#718
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/pathlib-typeerror-frozen-env

Conversation

@sentry

@sentry sentry Bot commented Jun 11, 2026

Copy link
Copy Markdown

This PR addresses issue CLI-EY, a TypeError: unsupported operand type(s) for /: 'PosixPath' and 'str' that occurred in codecov_cli/helpers/folder_searcher.py.

The root cause was identified as an incompatibility with pathlib.Path.__truediv__ (the / operator for path joining) when running in a PyInstaller-frozen CPython 3.9.5 environment. Specifically, pathlib's internal validation using os.fspath() on the string operand failed, causing __truediv__ to return NotImplemented and Python to raise the TypeError.

The issue was triggered by the gcov plugin, which is part of the default plugin list and unconditionally calls search_files over the project root, even when only explicit non-gcov coverage files are specified.

To fix this, the three occurrences of pathlib.Path(dirpath) / name in folder_searcher.py have been replaced with pathlib.Path(os.path.join(str(dirpath), name)). This change bypasses the problematic pathlib.__truediv__ operator by using the standard os.path.join for string-based path concatenation, then converting the result back to a pathlib.Path object. This ensures compatibility within the frozen executable environment.

Fixes CLI-EY

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
700 1 699 1
View the full list of 1 ❄️ flaky test(s)
api.temp.calculator.test_calculator::test_divide

Flake rate in main: 100.00% (Passed 0 times, Failed 214 times)

Stack Traces | 0.001s run time
def
                test_divide():
                > assert Calculator.divide(1, 2) == 0.5
                E assert 1.0 == 0.5
                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)
                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide
                .../temp/calculator/test_calculator.py:30: AssertionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

0 participants