Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more DateTime.into tests (branch 0.4.x) #1088

Closed
wants to merge 1 commit into from

Conversation

jtmoon79
Copy link
Contributor

@jtmoon79 jtmoon79 commented May 28, 2023

More tests for combinations of DateTime::into.

Follow-up to Pull Request #271.

@jtmoon79 jtmoon79 marked this pull request as ready for review May 28, 2023 03:52
@jtmoon79 jtmoon79 force-pushed the Issue263_more_tests_0.4.x branch 2 times, most recently from 7b4da00 to 0127fd7 Compare May 28, 2023 03:56
Copy link
Collaborator

@pitdicker pitdicker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Unrelated note:
I am somewhat surprised to two DateTimes with different time zones compare equal, while for example their debug format is different. An Ord implementation makes sense, but what do you think of this?

Not that it can be changed in 0.4.x.

@jtmoon79
Copy link
Contributor Author

jtmoon79 commented May 28, 2023

I am somewhat surprised to two DateTimes with different time zones compare equal

They are the same instant just in different time zones. It makes intuitive sense to me. 🤷

@djc
Copy link
Member

djc commented May 30, 2023

I think we should first start to track coverage so we can judge whether this actually improves coverage.

@pitdicker
Copy link
Collaborator

I think we should first start to track coverage so we can judge whether this actually improves coverage.

@jtmoon79 Do you want to rebase and see what the coverage is?

@jtmoon79 jtmoon79 force-pushed the Issue263_more_tests_0.4.x branch 2 times, most recently from af4d8a4 to e282568 Compare September 21, 2023 05:12
@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Merging #1088 (546dd9d) into 0.4.x (a47e0e3) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##            0.4.x    #1088      +/-   ##
==========================================
+ Coverage   91.24%   91.31%   +0.06%     
==========================================
  Files          38       38              
  Lines       17062    17094      +32     
==========================================
+ Hits        15568    15609      +41     
+ Misses       1494     1485       -9     
Files Changed Coverage Δ
src/datetime/tests.rs 96.59% <100.00%> (+0.08%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jtmoon79 jtmoon79 force-pushed the Issue263_more_tests_0.4.x branch 2 times, most recently from 6df882c to 48f88fc Compare September 21, 2023 05:28
@jtmoon79
Copy link
Contributor Author

From the Codecov report:

Total increase

+ Coverage 91.36% 91.43% +0.07%

per file increase

src/datetime/mod.rs 88.40% <100.00%> (+2.14%)

IMO it's worthwhile to add. Up to you guys.

@jtmoon79
Copy link
Contributor Author

jtmoon79 commented Sep 21, 2023

codecov is now reporting

- Coverage 91.36% 90.42% -0.94%

src/datetime/mod.rs 77.22% <100.00%> (-9.03%)

🤨

Is there a way to kick it?

src/datetime/mod.rs Outdated Show resolved Hide resolved
src/datetime/mod.rs Outdated Show resolved Hide resolved
}

#[test]
fn test_auto_conversion_fixedoffset_into_utc() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a simpler way to cover the same as this test and the following?

#[cfg(feature = "clock")]
#[test]
fn test_auto_conversion() {
    let dt = NaiveDate::from_ymd_opt(2018, 9, 5).unwrap().and_hms_opt(23, 58, 0).unwrap();
    let dt_utc = Utc.from_utc_datetime(&dt);
    let dt_fixedoffset = FixedOffset::west_opt(5 * 60 * 60).unwrap().from_utc_datetime(&dt);
    let dt_local = Local.from_utc_datetime(&dt);

    assert_eq!(dt_utc, DateTime::<Utc>::from(dt_fixedoffset));
    assert_eq!(dt_utc, DateTime::<Utc>::from(dt_local));
    assert_eq!(dt_fixedoffset, DateTime::<FixedOffset>::from(dt_utc));
    assert_eq!(dt_fixedoffset, DateTime::<FixedOffset>::from(dt_local));
    assert_eq!(dt_local, DateTime::<Local>::from(dt_utc));
    assert_eq!(dt_local, DateTime::<Local>::from(dt_fixedoffset));
}

Copy link
Contributor Author

@jtmoon79 jtmoon79 Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is considered best practice to prefer many small tests each exercising fewer things rather than fewer larger tests each exercising many things.

@pitdicker
Copy link
Collaborator

Is there a way to kick it?

Sometimes I would like to 🤣.

In this case I think it started counting some of the lines in mod tests in the total, decreasing the covered percentage.

More tests for combinations of `DateTime::into`.

Follow-up to Pull Request chronotope#271.
@jtmoon79
Copy link
Contributor Author

jtmoon79 commented Sep 25, 2023

workflow codecov failed. These are often fixed by running again. I don't have access to force a re-run of the codecov workflow.

[2023-09-25T01:25:26.367Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-3.1.4-uploader-0.6.2&token=*******&branch=Issue263_more_tests_0.4.x&build=6293693314&build_url=https%3A%2F%2Fgit.luolix.top%2Fchronotope%2Fchrono%2Factions%2Fruns%2F6293693314&commit=546dd9d56abc73bd2b615cbc7165432707f8fb96&job=codecov&pr=1088&service=github-actions&slug=chronotope%2Fchrono&name=&tag=&flags=&parent=
[2023-09-25T01:25:26.644Z] ['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) > Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v3/dist/codecov' failed with exit code 255

@djc
Copy link
Member

djc commented Sep 25, 2023

Triggered a re-run.

@pitdicker
Copy link
Collaborator

@jtmoon79 Thank you for you efforts!

Unfortunately I don't think these tests add enough value to merge 😞.

@pitdicker pitdicker closed this Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants