python / python/mypy

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

オープン
#9,812 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug topic-mypyc
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

mypyс/test/test_external.py と mypyc/external/googletest/make/Makefile の22行目から始めます。システムにインストールされた Google Test を使ってテストを再現し、コンパイラコマンドとインクルードパスを調べ、それらのヘッダーがインストールされている場合に Google Test ライブラリが正常にビルドされることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, python
領域
build-system, testing-qa
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。