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

Use locale during date formatting #22

Merged
merged 17 commits into from
Mar 27, 2020

Conversation

Guts
Copy link
Contributor

@Guts Guts commented Mar 27, 2020

Close #21 with consequences on test:

  • use mkdocs configuration loader to control how the locale option is set and used
  • add a class test to check the different cases of on_config method

@timvink
Copy link
Owner

timvink commented Mar 27, 2020

Good catch!

Can you have a look at the failing tests?

@Guts
Copy link
Contributor Author

Guts commented Mar 27, 2020

Yeah I'm on it but I'm not sure why they are failing because I can build in strict mode 🤔

@timvink
Copy link
Owner

timvink commented Mar 27, 2020

Let me know if you want me to have a look

@Guts
Copy link
Contributor Author

Guts commented Mar 27, 2020

Can you have a look at the failing tests?

Got it. Tests are comparing localized dates with no localized dates because locale is not passed...

repo = Util(testproject_path)
date_formats = repo.get_revision_date_for_file(
testproject_path / 'docs/page_with_tag.md')
searches = [re.search(x, contents) for x in date_formats.values()]
assert any(searches), "No correct date formats output was found"

@codecov-io
Copy link

codecov-io commented Mar 27, 2020

Codecov Report

Merging #22 into master will decrease coverage by 6.13%.
The diff coverage is 90.32%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
- Coverage   92.59%   86.45%   -6.14%     
==========================================
  Files           2        2              
  Lines          81       96      +15     
==========================================
+ Hits           75       83       +8     
- Misses          6       13       +7     
Flag Coverage Δ
#unittests 86.45% <90.32%> (-6.14%) ⬇️
Impacted Files Coverage Δ
...kdocs_git_revision_date_localized_plugin/plugin.py 93.87% <89.65%> (-6.13%) ⬇️
mkdocs_git_revision_date_localized_plugin/util.py 78.72% <100.00%> (-8.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6647ef...e0ba530. Read the comment docs.

@Guts
Copy link
Contributor Author

Guts commented Mar 27, 2020

@timvink I had to rewrite a part of test and plugin (on_config method) to get a clearer view on why tests were failing. Finally it's just a problem with the regex used to match rendered date, only on Windows.

@Guts
Copy link
Contributor Author

Guts commented Mar 27, 2020

Finally it's just a problem with the regex used to match rendered date, only on Windows.

Fixed setting the encoding in read_text method.

@Guts
Copy link
Contributor Author

Guts commented Mar 27, 2020

@timvink sorry for the mess, but I was stuck with tests running which were no handling the locale value.

Now, it's good and, I hope, a bit better ;)

Copy link
Owner

@timvink timvink left a comment

Choose a reason for hiding this comment

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

Thanks for extending the tests! I have just a couple of comments :)

mkdocs_git_revision_date_localized_plugin/plugin.py Outdated Show resolved Hide resolved
tests/basic_setup/mkdocs_locale.yml Show resolved Hide resolved
tests/test_basic.py Show resolved Hide resolved
tests/test_plugin.py Show resolved Hide resolved
@timvink timvink merged commit be1e0a3 into timvink:master Mar 27, 2020
@timvink
Copy link
Owner

timvink commented Mar 27, 2020

Thanks again @Guts 🎉

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.

Formatted date is not localized
3 participants