回答編集履歴

3

オプション間違いの訂正。結果の追記。

2019/07/08 07:33

投稿

quickquip
quickquip

スコア11038

test CHANGED
@@ -60,11 +60,17 @@
60
60
 
61
61
  cd (some)/workspacefolder
62
62
 
63
- python -m unittest discover -d project tests
63
+ python -m unittest discover -t project -s tests
64
64
 
65
65
  ```
66
66
 
67
- でunittestを起動するのではないでしょうか。(試していませんが)
67
+ ~~でunittestを起動するのではないでしょうか。(試していませんが)~~
68
+
69
+
70
+
71
+ 追記
72
+
73
+ 想定されていないディクレトリ構成なのでしょう。`AssertionError: Path must be within the project`が出て停止するようです。
68
74
 
69
75
 
70
76
 

2

些細

2019/07/08 07:32

投稿

quickquip
quickquip

スコア11038

test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
 
48
48
 
49
- [https://docs.python.org/ja/3/library/unittest.html#test-discovery]
49
+ [https://docs.python.org/ja/3/library/unittest.html#test-discovery](https://docs.python.org/ja/3/library/unittest.html#test-discovery)
50
50
 
51
51
 
52
52
 

1

追記

2019/07/05 08:39

投稿

quickquip
quickquip

スコア11038

test CHANGED
@@ -26,6 +26,48 @@
26
26
 
27
27
 
28
28
 
29
+ [https://docs.python.org/ja/3/library/unittest.html#command-line-interface](https://docs.python.org/ja/3/library/unittest.html#command-line-interface)
30
+
31
+
32
+
33
+ > python -m unittest tests/test_something.py
34
+
35
+ >
36
+
37
+ > そのため、テストモジュールを指定するのにシェルのファイル名補完が使えます。指定されたファイルはやはりモジュールとしてインポート可能でなければなりません。パスから '.py' を取り除き、パスセパレータを '.' に置き換えることでモジュール名に変換されます。
38
+
39
+
40
+
41
+ ----
42
+
43
+
44
+
45
+ あるいは質問の構造であれば、
46
+
47
+
48
+
49
+ [https://docs.python.org/ja/3/library/unittest.html#test-discovery]
50
+
51
+
52
+
53
+
54
+
55
+ > -t, --top-level-directory directory
56
+
57
+ > プロジェクトの最上位のディスカバリのディレクトリ (デフォルトは開始のディレクトリ)
58
+
59
+ ```
60
+
61
+ cd (some)/workspacefolder
62
+
63
+ python -m unittest discover -d project tests
64
+
65
+ ```
66
+
67
+ でunittestを起動するのではないでしょうか。(試していませんが)
68
+
69
+
70
+
29
71
  ----
30
72
 
31
73