Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

Commit 59879ad

Browse files
committed
fix(tests): Tests now work for all versions, seal is no-op'd in version 3.6 only
1 parent df165e9 commit 59879ad

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

tests/test_upload.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ def test_uploadBlock_collection():
135135
#TODO: This is incomplete...
136136

137137
def MockClient():
138-
from unittest.mock import seal #Python 3.7+ only!
138+
#No-op, seal doesn't exist in Python 3.6
139+
if sys.version_info >= (3,7,0):
140+
from unittest.mock import seal
141+
else:
142+
seal = lambda x: x
139143
notionClient = Mock()
140144
notionClient.return_value = notionClient
141145
getBlock = Mock(spec=PageBlock)
@@ -157,15 +161,13 @@ def remove():
157161
seal(notionClient)
158162
return notionClient
159163

160-
@pytest.mark.skipif(sys.version_info < (3,7), reason="requires python3.7+")
161164
@patch('notion.client.NotionClient', new_callable=MockClient)
162165
def test_cli_no_arguments(mockClient):
163166
'''should error when nothing is passed'''
164167
#act/assert
165168
with pytest.raises(SystemExit):
166169
cli([])
167170

168-
@pytest.mark.skipif(sys.version_info < (3,7), reason="requires python3.7+")
169171
@patch('md2notion.upload.upload')
170172
@patch('notion.client.NotionClient', new_callable=MockClient)
171173
def test_cli_create_single_page(mockClient, upload):
@@ -181,7 +183,6 @@ def test_cli_create_single_page(mockClient, upload):
181183
assert args0[1] == mockClient.get_block.return_value.children[0]
182184
assert args0[1].title == 'TEST.md'
183185

184-
@pytest.mark.skipif(sys.version_info < (3,7), reason="requires python3.7+")
185186
@patch('md2notion.upload.upload')
186187
@patch('notion.client.NotionClient', new_callable=MockClient)
187188
def test_cli_create_multiple_pages(mockClient, upload):
@@ -199,7 +200,6 @@ def test_cli_create_multiple_pages(mockClient, upload):
199200
assert args1[1] == mockClient.get_block.return_value.children[1]
200201
assert args1[1].title == 'COMPREHENSIVE_TEST.md'
201202

202-
@pytest.mark.skipif(sys.version_info < (3,7), reason="requires python3.7+")
203203
@patch('md2notion.upload.upload')
204204
@patch('notion.client.NotionClient', new_callable=MockClient)
205205
def test_cli_append(mockClient, upload):
@@ -214,7 +214,6 @@ def test_cli_append(mockClient, upload):
214214
assert args0[0].name == 'tests/TEST.md'
215215
assert args0[1] == mockClient.get_block.return_value
216216

217-
@pytest.mark.skipif(sys.version_info < (3,7), reason="requires python3.7+")
218217
@patch('md2notion.upload.upload')
219218
@patch('notion.client.NotionClient', new_callable=MockClient)
220219
def test_cli_clear_previous(mockClient, upload):

0 commit comments

Comments
 (0)