yhttp-dev 3.1.2__tar.gz → 3.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yhttp-dev
3
- Version: 3.1.2
3
+ Version: 3.2.4
4
4
  Summary: yhttp development utilities
5
5
  Home-page: https://github.com/yhttp/yhttp-dev
6
6
  Author: pylover
@@ -0,0 +1 @@
1
+ __version__ = '3.2.4'
@@ -3,6 +3,7 @@ import shutil
3
3
  import socket
4
4
  import tempfile
5
5
  import datetime
6
+ import contextlib
6
7
  from unittest.mock import patch
7
8
 
8
9
  import pytest
@@ -129,5 +130,34 @@ def redis():
129
130
  hashtable = self.maindict.setdefault(key, {})
130
131
  return hashtable[field]
131
132
 
133
+ def close(self):
134
+ # Do nothing here, this methog is needed for just compatibiliy.
135
+ pass
136
+
132
137
  with patch('redis.Redis', new=RedisMock) as p:
133
138
  yield p
139
+
140
+
141
+ @pytest.fixture(scope='session')
142
+ def htmlfile():
143
+ @contextlib.contextmanager
144
+ def create(filename, title, cssfile=None):
145
+ with open(filename, 'a') as file:
146
+ file.truncate(0)
147
+ file.write(
148
+ '<!DOCTYPE html>\n'
149
+ '<html lang="en">\n'
150
+ '<head>\n'
151
+ '<meta charset="utf-8" />\n'
152
+ f'<title>{title}</title>\n'
153
+ )
154
+
155
+ if cssfile:
156
+ file.write(f'<link rel="stylesheet" href="{cssfile}" '
157
+ 'type="text/css" />\n')
158
+
159
+ file.write('</head><body>\n')
160
+ yield file
161
+ file.write('</body></html>')
162
+
163
+ return create
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yhttp-dev
3
- Version: 3.1.2
3
+ Version: 3.2.4
4
4
  Summary: yhttp development utilities
5
5
  Home-page: https://github.com/yhttp/yhttp-dev
6
6
  Author: pylover
@@ -1 +0,0 @@
1
- __version__ = '3.1.2'
File without changes
File without changes
File without changes
File without changes