Coder Social home page Coder Social logo

Comments (7)

akoumjian avatar akoumjian commented on July 27, 2024

@thebigspoon care to elaborate?

from datefinder.

ranchodeluxe avatar ranchodeluxe commented on July 27, 2024

@lindauer: Yummy!
Could you tell me what operating system you are on?
Could you also run the following commands in a Python shell with an environment that has python-dateutil installed? Let me know what gets returned please:

In [23]: import dateutil
In [24]: dateutil.tz.gettz('IRST')

breakdown

Yes, the problem is the test and probably the assumption that the operating system the test is running on doesn't have zoneinfo for the timezone abbreviation -- IRST. Good catch!

dateutil.tz.gettz is basically a big if/else booby trap hunting for the right timezone files ( here ). On Ubuntu 14.04 it is looking to resolve IRST at this location:

In [22]: ls -lah /usr/share/zoneinfo/I*
-rw-r--r-- 1 root root 1.2K Jun 13  2014 /usr/share/zoneinfo/Iceland
-rw-r--r-- 1 root root 1.7K Jun 13  2014 /usr/share/zoneinfo/Iran
-rw-r--r-- 1 root root 2.2K Jun 13  2014 /usr/share/zoneinfo/Israel

It doesn't find it and therefore tries to replace the tzinfo with None which mean it returns a naive datetime ( here ) as the test was designed.

My guess is that the dateutil.tz.gettz lookup resolves for you and returns legitimate tzinfo.

The test should probably use a really really wrong timezone abbreviation such as NOT_A_TIMEZONE ;-)

from datefinder.

lindauer avatar lindauer commented on July 27, 2024

It actually returns None for me, too. Upon closer examination, I think it's the CST test failing, not the IRST test. I'm on OSX 10.10.5.

from datefinder.

ranchodeluxe avatar ranchodeluxe commented on July 27, 2024

@lindauer:
so this does return something for you?

In [23]: import dateutil
In [24]: dateutil.tz.gettz('CST')

from datefinder.

lindauer avatar lindauer commented on July 27, 2024

It does!

>>> import dateutil.tz
>>> dateutil.tz.gettz('CST')
tzlocal()

from datefinder.

ranchodeluxe avatar ranchodeluxe commented on July 27, 2024

@lindauer: thanks for sticking with this. I was able to reproduce the recurring issue you mention in PR #12 on OSX. For some reason the mock was not taking in the environment of OSX and anaconda. It's was working fine on Ubuntu and CentOS.

So I've adjusted the mock in PR #13. If you could merge that PR locally and test it out I'd really appreciate it.

from datefinder.

ranchodeluxe avatar ranchodeluxe commented on July 27, 2024

works, see notes on PR #13. closing

from datefinder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.