Skip to content

Commit 55a843e

Browse files
authored
Split build unit tests out from code (#1961)
* separate out codegen_helper tests * separate out documentation_helper tests * separate out documentation_snippets tests * separate out helper tests * separate out metadata_add_all tests * separate out metadata_merge_dicts tests * Explain the difference between the 2 calls to pytest (since I decided to keep both) * Use --append to merge coverage results from the 2 runs
1 parent c69b58f commit 55a843e

14 files changed

+3529
-3520
lines changed

build/helper/codegen_helper.py

Lines changed: 0 additions & 1328 deletions
Large diffs are not rendered by default.

build/helper/documentation_helper.py

Lines changed: 0 additions & 730 deletions
Large diffs are not rendered by default.

build/helper/documentation_snippets.py

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -142,124 +142,3 @@ def initiate_function_def_for_doc(functions, config):
142142

143143
return function_def
144144

145-
146-
def test_close_function_def_for_doc_note_not_list():
147-
'''Testing for lack of syntax error - not actual documentation'''
148-
functions = {
149-
'close': {
150-
'documentation': {
151-
'description': 'test',
152-
'note': 'test',
153-
},
154-
},
155-
}
156-
config = {
157-
'close_function': 'close'
158-
}
159-
close_doc = close_function_def_for_doc(functions, config)
160-
assert type(close_doc) is dict
161-
return
162-
163-
164-
def test_close_function_def_for_doc_note_list():
165-
'''Testing for lack of syntax error - not actual documentation'''
166-
functions = {
167-
'close': {
168-
'documentation': {
169-
'description': 'test',
170-
'note': ['test'],
171-
},
172-
},
173-
}
174-
config = {
175-
'close_function': 'close'
176-
}
177-
close_doc = close_function_def_for_doc(functions, config)
178-
assert type(close_doc) is dict
179-
return
180-
181-
182-
def test_close_function_def_for_doc_no_note():
183-
'''Testing for lack of syntax error - not actual documentation'''
184-
functions = {
185-
'close': {
186-
'documentation': {
187-
'description': 'test',
188-
},
189-
},
190-
}
191-
config = {
192-
'close_function': 'close'
193-
}
194-
close_doc = close_function_def_for_doc(functions, config)
195-
assert type(close_doc) is dict
196-
197-
198-
def test_initiate_function_def_for_doc_note_not_list():
199-
'''Testing for lack of syntax error - not actual documentation'''
200-
functions = {
201-
'Initiate': {
202-
'documentation': {
203-
'description': 'test',
204-
'note': 'test',
205-
},
206-
'python_name': '_initiate',
207-
},
208-
}
209-
config = {
210-
'context_manager_name': {
211-
'task': 'acquisition',
212-
'initiate_function': 'Initiate',
213-
'abort_function': 'Abort',
214-
},
215-
}
216-
initiate_doc = initiate_function_def_for_doc(functions, config)
217-
assert type(initiate_doc) is dict
218-
return
219-
220-
221-
def test_initiate_function_def_for_doc_note_list():
222-
'''Testing for lack of syntax error - not actual documentation'''
223-
functions = {
224-
'Initiate': {
225-
'documentation': {
226-
'description': 'test',
227-
'note': ['test'],
228-
},
229-
'python_name': '_initiate',
230-
},
231-
}
232-
config = {
233-
'context_manager_name': {
234-
'task': 'acquisition',
235-
'initiate_function': 'Initiate',
236-
'abort_function': 'Abort',
237-
},
238-
}
239-
initiate_doc = initiate_function_def_for_doc(functions, config)
240-
assert type(initiate_doc) is dict
241-
return
242-
243-
244-
def test_initiate_function_def_for_doc_no_note():
245-
'''Testing for lack of syntax error - not actual documentation'''
246-
functions = {
247-
'Initiate': {
248-
'documentation': {
249-
'description': 'test',
250-
},
251-
'python_name': '_initiate',
252-
},
253-
}
254-
config = {
255-
'context_manager_name': {
256-
'task': 'acquisition',
257-
'initiate_function': 'Initiate',
258-
'abort_function': 'Abort',
259-
},
260-
}
261-
initiate_doc = initiate_function_def_for_doc(functions, config)
262-
assert type(initiate_doc) is dict
263-
264-
265-

build/helper/helper.py

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -151,137 +151,3 @@ def enum_uses_converter(enum):
151151
)
152152
return has_enum_to_converted_value_function_name and has_converted_value_to_enum_function_name
153153

154-
155-
# Tests
156-
def test_get_development_status():
157-
config = {}
158-
159-
config['module_version'] = '0.0.0.dev0'
160-
assert get_development_status(config) == '3 - Alpha'
161-
162-
config['module_version'] = '0.0.0'
163-
assert get_development_status(config) == '3 - Alpha'
164-
165-
config['module_version'] = '0.4.9.dev0'
166-
assert get_development_status(config) == '3 - Alpha'
167-
168-
config['module_version'] = '0.4.9'
169-
assert get_development_status(config) == '3 - Alpha'
170-
171-
config['module_version'] = '0.5.0.dev0'
172-
assert get_development_status(config) == '4 - Beta'
173-
174-
config['module_version'] = '0.5.0'
175-
assert get_development_status(config) == '4 - Beta'
176-
177-
config['module_version'] = '0.9.9.dev0'
178-
assert get_development_status(config) == '4 - Beta'
179-
180-
config['module_version'] = '0.9.9'
181-
assert get_development_status(config) == '4 - Beta'
182-
183-
config['module_version'] = '1.0.0.dev0'
184-
assert get_development_status(config) == '3 - Alpha'
185-
186-
config['module_version'] = '1.0.0.a0'
187-
assert get_development_status(config) == '3 - Alpha'
188-
189-
config['module_version'] = '1.0.0.b0'
190-
assert get_development_status(config) == '4 - Beta'
191-
192-
config['module_version'] = '1.0.0.c0'
193-
assert get_development_status(config) == '4 - Beta'
194-
195-
config['module_version'] = '1.0.0.rc0'
196-
assert get_development_status(config) == '4 - Beta'
197-
198-
config['module_version'] = '1.0.0'
199-
assert get_development_status(config) == '5 - Production/Stable'
200-
201-
config['module_version'] = '1.9.9.dev0'
202-
assert get_development_status(config) == '3 - Alpha'
203-
204-
config['module_version'] = '1.9.9.a0'
205-
assert get_development_status(config) == '3 - Alpha'
206-
207-
config['module_version'] = '1.9.9.b0'
208-
assert get_development_status(config) == '4 - Beta'
209-
210-
config['module_version'] = '1.9.9.c0'
211-
assert get_development_status(config) == '4 - Beta'
212-
213-
config['module_version'] = '1.9.9.rc0'
214-
assert get_development_status(config) == '4 - Beta'
215-
216-
config['module_version'] = '1.9.9'
217-
assert get_development_status(config) == '5 - Production/Stable'
218-
219-
config['module_version'] = '9.9.9.dev0'
220-
assert get_development_status(config) == '3 - Alpha'
221-
222-
config['module_version'] = '9.9.9.a0'
223-
assert get_development_status(config) == '3 - Alpha'
224-
225-
config['module_version'] = '9.9.9.b0'
226-
assert get_development_status(config) == '4 - Beta'
227-
228-
config['module_version'] = '9.9.9.c0'
229-
assert get_development_status(config) == '4 - Beta'
230-
231-
config['module_version'] = '9.9.9.rc0'
232-
assert get_development_status(config) == '4 - Beta'
233-
234-
config['module_version'] = '9.9.9'
235-
assert get_development_status(config) == '5 - Production/Stable'
236-
237-
config['module_version'] = '19.9.9.dev0'
238-
assert get_development_status(config) == '3 - Alpha'
239-
240-
config['module_version'] = '19.9.9.a0'
241-
assert get_development_status(config) == '3 - Alpha'
242-
243-
config['module_version'] = '19.9.9.b0'
244-
assert get_development_status(config) == '4 - Beta'
245-
246-
config['module_version'] = '19.9.9.c0'
247-
assert get_development_status(config) == '4 - Beta'
248-
249-
config['module_version'] = '19.9.9.rc0'
250-
assert get_development_status(config) == '4 - Beta'
251-
252-
config['module_version'] = '19.9.9'
253-
assert get_development_status(config) == '5 - Production/Stable'
254-
255-
256-
def test_enum_uses_converter():
257-
import pytest
258-
259-
assert not enum_uses_converter({})
260-
assert not enum_uses_converter({
261-
'enum_to_converted_value_function_name': None,
262-
'converted_value_to_enum_function_name': None
263-
})
264-
265-
assert enum_uses_converter({
266-
'enum_to_converted_value_function_name': lambda x: x,
267-
'converted_value_to_enum_function_name': lambda x: x
268-
})
269-
270-
with pytest.raises(AssertionError):
271-
enum_uses_converter({
272-
'enum_to_converted_value_function_name': lambda x: x
273-
})
274-
with pytest.raises(AssertionError):
275-
enum_uses_converter({
276-
'converted_value_to_enum_function_name': lambda x: x
277-
})
278-
with pytest.raises(AssertionError):
279-
enum_uses_converter({
280-
'enum_to_converted_value_function_name': None,
281-
'converted_value_to_enum_function_name': lambda x: x
282-
})
283-
with pytest.raises(AssertionError):
284-
enum_uses_converter({
285-
'enum_to_converted_value_function_name': lambda x: x,
286-
'converted_value_to_enum_function_name': None
287-
})

0 commit comments

Comments
 (0)