Python

Vagrantのshared_folderでマウント時にnosetestsでテストが読み込まれない

Pythonでテストを実行する時nosenosetestsを使っているのですがVagrantのshared_folderでマウントしてるディレクトリでnosetestsと実行してもテストクラスとして有効になりませんでした。
原因は対象となるファイルに実行権があるとデフォルトでは対象外になるみたいです。
Finding and running tests
マニュアルにも書いてあるのですが

Files with the executable bit set are ignored by default under Unix-style operating systems–use --exe to allow collection from them, but be careful that is safe to do so. Under Windows, executable files will be picked up by default since there is no executable bit to test.

上記のように--exeオプションをつければ対象となります。

-Python

© 2023 ビー鉄のブログ Powered by AFFINGER5