@@ -108,7 +108,8 @@ def test_foo(pytestconfig):
108
108
assert result .ret == 0
109
109
110
110
@pytest .mark .parametrize ('mode' , ['plain' , 'rewrite' ])
111
- def test_installed_plugin_rewrite (self , testdir , mode ):
111
+ @pytest .mark .parametrize ('plugin_state' , ['development' , 'installed' ])
112
+ def test_installed_plugin_rewrite (self , testdir , mode , plugin_state ):
112
113
# Make sure the hook is installed early enough so that plugins
113
114
# installed via setuptools are re-written.
114
115
testdir .tmpdir .join ('hampkg' ).ensure (dir = 1 )
@@ -135,13 +136,22 @@ def check(values, value):
135
136
'mainwrapper.py' : """
136
137
import pytest, pkg_resources
137
138
139
+ plugin_state = "{plugin_state}"
140
+
138
141
class DummyDistInfo:
139
142
project_name = 'spam'
140
143
version = '1.0'
141
144
142
145
def _get_metadata(self, name):
143
- return ['spamplugin.py,sha256=abc,123',
144
- 'hampkg/__init__.py,sha256=abc,123']
146
+ # 'RECORD' meta-data only available in installed plugins
147
+ if name == 'RECORD' and plugin_state == "installed":
148
+ return ['spamplugin.py,sha256=abc,123',
149
+ 'hampkg/__init__.py,sha256=abc,123']
150
+ # 'SOURCES.txt' meta-data only available for plugins in development mode
151
+ elif name == 'SOURCES.txt' and plugin_state == "development":
152
+ return ['spamplugin.py',
153
+ 'hampkg/__init__.py']
154
+ return []
145
155
146
156
class DummyEntryPoint:
147
157
name = 'spam'
@@ -159,7 +169,7 @@ def iter_entry_points(name):
159
169
160
170
pkg_resources.iter_entry_points = iter_entry_points
161
171
pytest.main()
162
- """ ,
172
+ """ . format ( plugin_state = plugin_state ) ,
163
173
'test_foo.py' : """
164
174
def test(check_first):
165
175
check_first([10, 30], 30)
0 commit comments