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

SOURCE_DATE_EPOCH causes test failures #131

Closed
eli-schwartz opened this issue Jul 28, 2020 · 2 comments · Fixed by #132
Closed

SOURCE_DATE_EPOCH causes test failures #131

eli-schwartz opened this issue Jul 28, 2020 · 2 comments · Fixed by #132
Labels
Milestone

Comments

@eli-schwartz
Copy link
Contributor

eli-schwartz commented Jul 28, 2020

Running the entire build/test/install cycle for asciidoc itself with this environment variable set, causes the testsuite to see surprising output. Many tests fail with output like this:

+++ tests/data/oldtables-html4.html
--- got
- 2020-07-28 00:58:43 UTC
+ 2002-11-25 00:37:42 UTC

+++ tests/data/oldtables-xhtml11.html
--- got
- 2020-07-28 00:58:43 UTC
+ 2002-11-25 00:37:42 UTC

Solution: tests/testasciidoc.py should account for this in mock_localtime. Most likely, you could remove this entirely, and rely on defining SOURCE_DATE_EPOCH in the test setup. Otherwise, it will need to be deleted from os.environ. The former would provide free testing for the feature though. :)

@MasterOdin
Copy link
Member

MasterOdin commented Jul 28, 2020

To be clear, you've got SOURCE_DATE_EPOCH set beforehand to whatever, and then when you run the test suite and it causes test failures?

@eli-schwartz
Copy link
Contributor Author

Yeah, sorry, I managed to lose that part of my sentence when filing this issue...

I ran into this while preparing the archlinux package update to 9.0.2 (yay python3) and I realized "hey, there is a testsuite here, it would be fantastic to run it while building the package".

This is not very urgent as it only prevents me from adding the testsuite to my packaging recipe. But I've solved that anyway by running it with env -u SOURCE_DATE_EPOCH make test, so even that is not an immediate issue.

eli-schwartz added a commit to eli-schwartz/asciidoc-py3 that referenced this issue Jul 28, 2020
$SOURCE_DATE_EPOCH is now the officially supported mechanism for
guaranteeing stable output timestamps, which means we can simply run the
tests using that, and drop some code.

This also fixes asciidoc-py#131 since the variable would override the mocked time,
resulting in tests failing if $SOURCE_DATE_EPOCH was set in the
environment (e.g. for linux distro packaging).
eli-schwartz added a commit to eli-schwartz/asciidoc-py3 that referenced this issue Jul 28, 2020
$SOURCE_DATE_EPOCH is now the officially supported mechanism for
guaranteeing stable output timestamps, which means we can simply run the
tests using that, and drop some code.

This also fixes asciidoc-py#131 since the variable would override the mocked time,
resulting in tests failing if $SOURCE_DATE_EPOCH was set in the
environment (e.g. for linux distro packaging).
@MasterOdin MasterOdin added the bug label Jul 28, 2020
@MasterOdin MasterOdin added this to the 9.0.3 milestone Jul 28, 2020
MasterOdin pushed a commit that referenced this issue Aug 5, 2020
$SOURCE_DATE_EPOCH is now the officially supported mechanism for
guaranteeing stable output timestamps, which means we can simply run the
tests using that, and drop some code.

This also fixes #131 since the variable would override the mocked time,
resulting in tests failing if $SOURCE_DATE_EPOCH was set in the
environment (e.g. for linux distro packaging).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants