python / python/mypy

testing: tests for mypyc failed when gtest was installed on my system

Open
#9,812 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-mypyc
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Bug Report

Within my fork of the mypy repo, the test mypyc/test/test_external.py failed while attempting to build libgtest.a with compilation errors like the following:

In file included from ../src/gtest-all.cc:42:
../src/gtest.cc:330:43: error: use of undeclared identifier 'GetArgvs'
static bool GTestIsInitialized() { return GetArgvs().size() > 0; }
                                          ^

To Reproduce

Run the tests as documented.

Expected Behavior

Ideally, compilation of the Google Test library should succeed, whether or not another version of Google Test is installed.

Actual Behavior

Compilation fails because the system-installed version of the header files are picked up. This is due to this line https://github.com/python/mypy/blob/05d9fb15dcec8bde4e7184ca387e7d8acea68792/mypyc/external/googletest/make/Makefile#L22 which adds the parent directory to the list of system includes. Running the compiler command with the -v option shows that the -I directives are then ignored, because they're seen as duplicates of the system paths.

Your Environment

My development environment is:
MacOS 10.15.7
Apple clang version 12
The latest commit in my clone of mypy is 05d9fb
brew install a recent version of Google Test.
Python interpreter version: 3.9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mypyc/test/test_external.py and mypyc/external/googletest/make/Makefile at line 22. Reproduce the test with a system-installed Google Test, inspect the compiler command and include paths, and confirm the Google Test library builds successfully when those headers are installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.