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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix random test failures in TestExcerpt #to_liquid #8884

Merged
merged 1 commit into from Nov 17, 2021

Conversation

philr
Copy link
Contributor

@philr philr commented Nov 16, 2021

This is a 馃悰 bug fix.

Summary

Failures can occur in the TestExcerpt #to_liquid test when the random seed orders TestFilters tests before TestExcerpt and the tests are run with a system time zone that's has a non-zero offset on 2013-07-22.

The TestFilters setup changes ENV["TZ"] to "UTC" but doesn't reset it.

The TestExcerpt #to_liquid test fails because @excerpt.to_liquid["date"] returns a UTC time and Time.parse("2013-07-22") returns a time in the system time zone:

Failure: TestExcerpt#test_: An extracted excerpt #to_liquid should contain the proper page data to mimic the post liquid.
[jekyll/test/test_excerpt.rb:103] Minitest::Assertion:
Expected: 2013-07-22 00:00:00 +0000
Actual: 2013-07-22 00:00:00 +0100

This pull request adds a teardown to TestFilters to reset ENV["TZ"].

Failures can occur when the random seed orders TestFilters tests before
TestExcerpt and the tests are run with a system time zone that's has a
non-zero offset on 2013-07-22.

The TestFilters setup changes ENV["TZ"] to "UTC" but doesn't reset it.

The TestExcerpt#to_liquid test fails because @excerpt.to_liquid["date"]
returns a UTC time and Time.parse("2013-07-22") returns a time in the
system time zone:

  Failure: TestExcerpt#test_: An extracted excerpt #to_liquid should
  contain the proper page data to mimic the post liquid.
  [jekyll/test/test_excerpt.rb:103] Minitest::Assertion:
  Expected: 2013-07-22 00:00:00 +0000
    Actual: 2013-07-22 00:00:00 +0100

Add a teardown to TestFilters to reset ENV["TZ"].
Copy link
Member

@mattr- mattr- left a comment

Choose a reason for hiding this comment

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

Great find! Thanks! 鉂わ笍

@ashmaroli
Copy link
Member

Thank you @philr
@jekyllbot: merge +dev

@jekyllbot jekyllbot merged commit 3a688fe into jekyll:master Nov 17, 2021
jekyllbot added a commit that referenced this pull request Nov 17, 2021
github-actions bot pushed a commit that referenced this pull request Nov 17, 2021
Phil Ross: Fix random test failures in TestExcerpt #to_liquid. (#8884)

Merge pull request 8884
@jekyll jekyll locked and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants