Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • janitor-team/proposed/tzdata
  • xnox/tzdata
2 results
Show changes
Commits on Source (2)
tzdata (2025a-2) unstable; urgency=medium
[ Aurelien Jarno ]
* Update Brazilian Portuguese debconf translation.
Thanks to Adriano Rafael Gomes <adrianorg@debian.org> (Closes: #1093450)
[ Benjamin Drung ]
* Add chrono autopkgtest to test C++ chrono library (LP: #2096974)
-- Benjamin Drung <bdrung@debian.org> Wed, 05 Feb 2025 12:38:27 +0100
tzdata (2025a-1) unstable; urgency=medium
* New upstream version 2025a
......
#!/usr/bin/python3
# Author: Benjamin Drung <bdrung@ubuntu.com>
"""Test C++ chrono module."""
import pathlib
import subprocess
import sys
import tempfile
import textwrap
import unittest
import zoneinfo
def is_symlink_zone(timezone: str) -> bool:
"""Check if the given timezone is an alternative name i. e. a symlink."""
zone = pathlib.Path("/usr/share/zoneinfo") / timezone
return zone.is_symlink()
class TestChrono(unittest.TestCase):
"""Test C++ chrono module."""
def test_get_tzdb_zones(self) -> None:
"""Test C++ std::chrono::get_tzdb().zones."""
with tempfile.TemporaryDirectory() as tempdir:
code_file = pathlib.Path(tempdir) / "get_tzdb.cxx"
code_file.write_text(
textwrap.dedent(
"""
#include <chrono>
#include <iostream>
int main() {
for (const auto & time_zone : std::chrono::get_tzdb().zones) {
std::cout << time_zone.name() << std::endl;
}
}
"""
)
)
command = pathlib.Path(tempdir) / "get_tzdb"
subprocess.run(
["g++", "-std=c++20", "-o", str(command), str(code_file)], check=True
)
output = subprocess.run(
[str(command)], capture_output=True, check=True, text=True
)
timezones = set(output.stdout.strip().split("\n"))
self.assertIn("Europe/Berlin", timezones)
expected_timezones = {
zone
for zone in zoneinfo.available_timezones()
if not is_symlink_zone(zone)
}
self.assertEqual(timezones, expected_timezones)
def main() -> None:
"""Run unit tests in verbose mode."""
argv = sys.argv.copy()
argv.insert(1, "-v")
unittest.main(argv=argv)
if __name__ == "__main__":
main()
Tests: chrono
Depends: g++, python3 (>= 3.9), tzdata
Restrictions: allow-stderr
Tests: debconf
Depends: python3, tzdata
Restrictions: allow-stderr needs-root
......