2727# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2828# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
30- from datetime import datetime , timezone
30+ from datetime import datetime , UTC
3131
3232from powerapi .database .csv .codecs import HWPCReportDecoder
3333from powerapi .report import HWPCReport
@@ -42,7 +42,7 @@ def test_decode_valid_csv_lines_with_one_events_group(self):
4242 """
4343 Test to decode valid CSV lines with one events group.
4444 """
45- ts = int (datetime .now (timezone . utc ).timestamp () * 1000 ) # milliseconds
45+ ts = int (datetime .now (tz = UTC ).timestamp () * 1000 ) # milliseconds
4646 lines = {'testg' : [
4747 {'timestamp' : ts , 'sensor' : 'pytest' , 'target' : 'example' , 'socket' : '0' , 'cpu' : '0' , 'event1' : 1 , 'event2' : 1 },
4848 {'timestamp' : ts , 'sensor' : 'pytest' , 'target' : 'example' , 'socket' : '0' , 'cpu' : '1' , 'event1' : 2 , 'event2' : 2 },
@@ -53,7 +53,7 @@ def test_decode_valid_csv_lines_with_one_events_group(self):
5353 report = HWPCReportDecoder ().decode (lines )
5454
5555 assert isinstance (report , HWPCReport )
56- assert report .timestamp == datetime .fromtimestamp (ts / 1000 , timezone . utc )
56+ assert report .timestamp == datetime .fromtimestamp (ts / 1000 , tz = UTC )
5757 assert report .sensor == 'pytest'
5858 assert report .target == 'example'
5959 assert report .metadata == {}
@@ -70,7 +70,7 @@ def test_decode_valid_csv_lines_with_multiple_events_groups(self):
7070 """
7171 Test to decode valid CSV lines with multiple events groups.
7272 """
73- ts = int (datetime .now (timezone . utc ).timestamp () * 1000 ) # milliseconds
73+ ts = int (datetime .now (tz = UTC ).timestamp () * 1000 ) # milliseconds
7474 lines = {
7575 'testg1' : [
7676 {'timestamp' : ts , 'sensor' : 'pytest' , 'target' : 'example' , 'socket' : '0' , 'cpu' : '0' , 'event1' : 1 , 'event2' : 1 },
@@ -85,7 +85,7 @@ def test_decode_valid_csv_lines_with_multiple_events_groups(self):
8585 report = HWPCReportDecoder ().decode (lines )
8686
8787 assert isinstance (report , HWPCReport )
88- assert report .timestamp == datetime .fromtimestamp (ts / 1000 , timezone . utc )
88+ assert report .timestamp == datetime .fromtimestamp (ts / 1000 , tz = UTC )
8989 assert report .sensor == 'pytest'
9090 assert report .target == 'example'
9191 assert report .metadata == {}
0 commit comments