How to use the tzlocal.unix._get_localzone function in tzlocal

To help you get started, we’ve selected a few tzlocal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ilius / starcal / tzlocal / tests.py View on Github external
def test_only_localtime(self):
        local_path = os.path.split(__file__)[0]
        tz = tzlocal.unix._get_localzone(_root=os.path.join(local_path, 'test_data', 'localtime'))
        self.assertEqual(tz.zone, 'local')
        dt = datetime(2012, 1, 1, 5)
        self.assertEqual(pytz.timezone('Africa/Harare').localize(dt), tz.localize(dt))
github ilius / starcal / tzlocal / tests.py View on Github external
def test_timezone(self):
        # Most versions of Ubuntu
        local_path = os.path.split(__file__)[0]
        tz = tzlocal.unix._get_localzone(_root=os.path.join(local_path, 'test_data', 'timezone'))
        self.assertEqual(tz.zone, 'Africa/Harare')
github regebro / tzlocal / tests / tests.py View on Github external
def test_vardbzoneinfo_setting(self):
        # A ZONE setting in /etc/conf.d/clock, f ex Gentoo

        tz = tzlocal.unix._get_localzone(_root=os.path.join(self.path, 'test_data', 'vardbzoneinfo'))
        self.assertEqual(tz.zone, 'Africa/Harare')
github pymedusa / Medusa / ext / tzlocal / tests.py View on Github external
def test_zone_setting(self):
        # A ZONE setting in /etc/sysconfig/clock, f ex CentOS

        tz = tzlocal.unix._get_localzone(_root=os.path.join(self.path, 'test_data', 'zone_setting'))
        self.assertEqual(tz.zone, 'Africa/Harare')
github regebro / tzlocal / tests / tests.py View on Github external
def test_fail(self):
        out = StringIO()
        stderr = sys.stderr
        try:
            sys.stderr = out
            tz = tzlocal.unix._get_localzone(
                _root=os.path.join(self.path, 'test_data'))
        finally:
            sys.stderr = stderr
        self.assertEqual(tz, pytz.utc)
        self.assertIn('Can not find any timezone configuration',
            out.getvalue())
github pymedusa / Medusa / ext / tzlocal / tests.py View on Github external
def test_fail(self):
        with self.assertRaises(pytz.exceptions.UnknownTimeZoneError):
            tz = tzlocal.unix._get_localzone(_root=os.path.join(self.path, 'test_data'))
github pymedusa / Medusa / ext / tzlocal / tests.py View on Github external
def test_timezone_setting(self):
        # A ZONE setting in /etc/conf.d/clock, f ex Gentoo

        tz = tzlocal.unix._get_localzone(_root=os.path.join(self.path, 'test_data', 'timezone_setting'))
        self.assertEqual(tz.zone, 'Africa/Harare')
github pymedusa / Medusa / ext / tzlocal / tests.py View on Github external
def test_only_localtime(self):
        tz = tzlocal.unix._get_localzone(_root=os.path.join(self.path, 'test_data', 'localtime'))
        self.assertEqual(tz.zone, 'local')
        dt = datetime(2012, 1, 1, 5)
        self.assertEqual(pytz.timezone('Africa/Harare').localize(dt), tz.localize(dt))
github Catch-up-TV-and-More / plugin.video.catchuptvandmore / resources / lib / tzlocal / tests.py View on Github external
def test_only_localtime(self):
        tz = tzlocal.unix._get_localzone(
            _root=os.path.join(self.path, 'test_data', 'localtime'))
        self.assertEqual(tz.zone, 'local')
        dt = datetime(2012, 1, 1, 5)
        self.assertEqual(
            pytz.timezone('Africa/Harare').localize(dt), tz.localize(dt))