File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 1
- __version__ = '3.1.3 '
1
+ __version__ = '3.2.0 '
Original file line number Diff line number Diff line change 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
@@ -135,3 +136,28 @@ def close(self):
135
136
136
137
with patch ('redis.Redis' , new = RedisMock ) as p :
137
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
You can’t perform that action at this time.
0 commit comments