Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions tests/test_datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ macro_rules! lock {

#[test]
fn test_date_check() {
lock!();
let gil = Python::acquire_gil();
let py = gil.python();
lock!();
let (obj, sub_obj, sub_sub_obj) = _get_subclasses(&py, "date", "2018, 1, 1").unwrap();

assert_check_exact!(PyDate_Check, obj);
Expand All @@ -78,9 +78,9 @@ fn test_date_check() {

#[test]
fn test_time_check() {
lock!();
let gil = Python::acquire_gil();
let py = gil.python();
lock!();
let (obj, sub_obj, sub_sub_obj) = _get_subclasses(&py, "time", "12, 30, 15").unwrap();

assert_check_exact!(PyTime_Check, obj);
Expand All @@ -90,9 +90,9 @@ fn test_time_check() {

#[test]
fn test_datetime_check() {
lock!();
let gil = Python::acquire_gil();
let py = gil.python();
lock!();
let (obj, sub_obj, sub_sub_obj) = _get_subclasses(&py, "datetime", "2018, 1, 1, 13, 30, 15")
.map_err(|e| e.print(py))
.unwrap();
Expand All @@ -105,9 +105,9 @@ fn test_datetime_check() {

#[test]
fn test_delta_check() {
lock!();
let gil = Python::acquire_gil();
let py = gil.python();
lock!();
let (obj, sub_obj, sub_sub_obj) = _get_subclasses(&py, "timedelta", "1, -3").unwrap();

assert_check_exact!(PyDelta_Check, obj);
Expand All @@ -120,9 +120,9 @@ fn test_datetime_utc() {
use assert_approx_eq::assert_approx_eq;
use pyo3::types::PyDateTime;

lock!();
let gil = Python::acquire_gil();
let py = gil.python();
lock!();
let datetime = py.import("datetime").map_err(|e| e.print(py)).unwrap();
let timezone = datetime.get("timezone").unwrap();
let utc = timezone.getattr("utc").unwrap().to_object(py);
Expand Down Expand Up @@ -161,6 +161,7 @@ static INVALID_TIMES: &[(u8, u8, u8, u32)] =
fn test_pydate_out_of_bounds() {
use pyo3::types::PyDate;

lock!();
// This test is an XFAIL on Python < 3.6 until bounds checking is implemented
let gil = Python::acquire_gil();
let py = gil.python();
Expand All @@ -176,6 +177,7 @@ fn test_pydate_out_of_bounds() {
fn test_pytime_out_of_bounds() {
use pyo3::types::PyTime;

lock!();
// This test is an XFAIL on Python < 3.6 until bounds checking is implemented
let gil = Python::acquire_gil();
let py = gil.python();
Expand All @@ -192,6 +194,7 @@ fn test_pydatetime_out_of_bounds() {
use pyo3::types::PyDateTime;
use std::iter;

lock!();
// This test is an XFAIL on Python < 3.6 until bounds checking is implemented
let gil = Python::acquire_gil();
let py = gil.python();
Expand Down