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

test_use_gmt_times fails with GMT[+1] timezones #478

Open
mjeveritt opened this issue Sep 20, 2018 · 4 comments
Open

test_use_gmt_times fails with GMT[+1] timezones #478

mjeveritt opened this issue Sep 20, 2018 · 4 comments

Comments

@mjeveritt
Copy link

============================= test session starts ==============================
platform linux2 -- Python 2.7.12, pytest-3.0.3, py-1.4.30, pluggy-0.4.0 -- /usr/bin/python2.7
cachedir: .cache
rootdir: /mnt/Files/pyftpdlib, inifile: 
plugins: hypothesis-3.6.0
collecting ... collected 764 items

pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_banner <- pyftpdlib/test/test_functional.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_masquerade_address <- pyftpdlib/test/test_functional.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_masquerade_address_map <- pyftpdlib/test/test_functional.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_max_connections <- pyftpdlib/test/__init__.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_max_connections_per_ip <- pyftpdlib/test/__init__.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_max_login_attempts <- pyftpdlib/test/test_functional.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_passive_ports <- pyftpdlib/test/test_functional.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_passive_ports_busy <- pyftpdlib/test/__init__.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_use_gmt_times <- pyftpdlib/test/__init__.py FAILED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_use_gmt_times <- pyftpdlib/test/__init__.py ERROR

==================================== ERRORS ====================================
___ ERROR at teardown of TestConfigurableOptionsTLSMixin.test_use_gmt_times ____

self = <FTPSServer(test-ftpd, stopped[SIGTERM])>

    def stop(self):
        self.server.close_all()
        self.terminate()
        self.join()
        reset_server_opts()
>       assert_free_resources()

pyftpdlib/test/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def assert_free_resources():
        ts = threading.enumerate()
        assert len(ts) == 1, ts
        p = psutil.Process()
        children = p.children()
>       assert not children, children
E       AssertionError: [<psutil.Process(pid=8711, name='pytest') at 140092828398864>]

pyftpdlib/test/__init__.py:258: AssertionError
=================================== FAILURES ===================================
______________ TestConfigurableOptionsTLSMixin.test_use_gmt_times ______________

args = (<pyftpdlib.test.test_functional_ssl.TestConfigurableOptionsTLSMixin testMethod=test_use_gmt_times>,)
kwargs = {}, x = 4
_ = AssertionError([<psutil.Process(pid=8711, name='pytest') at 140092828398864>],)
err = AssertionError([<psutil.Process(pid=8711, name='pytest') at 140092828398864>],)

    @functools.wraps(fun)
    def wrapper(*args, **kwargs):
        for x in range(ntimes or NO_RETRIES):
            try:
                return fun(*args, **kwargs)
            except AssertionError as _:
                err = _
>       raise err
E       AssertionError: [<psutil.Process(pid=8711, name='pytest') at 140092828398864>]

pyftpdlib/test/__init__.py:206: AssertionError
============================= 755 tests deselected =============================
========= 1 failed, 8 passed, 755 deselected, 1 error in 3.19 seconds ==========
@mjeveritt
Copy link
Author

  • Gentoo Linux
  • GMT+1 (BST) timezone here

@sbraz
Copy link
Contributor

sbraz commented Sep 20, 2018

I can confirm that this seems to fail when we use any UTC+0 timezone like Europe/Dublin. It is however fine with Atlantic/Cape_Verde (UTC-1) or Europe/Paris (UTC+1).

I had to kill pytest after it prints its summary because it hangs there.

$ pytest -k test_use_gmt_times -vv
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.6.6, pytest-3.6.3, py-1.5.4, pluggy-0.6.0 -- /usr/bin/python3.6
cachedir: .pytest_cache
rootdir: /tmp/pyftpdlib, inifile:
plugins: requests-mock-1.5.2, hypothesis-3.59.1, backports.unittest-mock-1.4
collected 770 items / 767 deselected                                                                                                                                                                              

pyftpdlib/test/test_functional.py::TestConfigurableOptions::test_use_gmt_times FAILED                                                                                                                       [ 33%]
pyftpdlib/test/test_functional.py::TestConfigurableOptions::test_use_gmt_times ERROR                                                                                                                        [ 33%]
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptions::test_use_gmt_times <- pyftpdlib/test/test_functional.py FAILED                                                                              [ 66%]
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptions::test_use_gmt_times <- pyftpdlib/test/test_functional.py ERROR                                                                               [ 66%]
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_use_gmt_times <- pyftpdlib/test/test_functional.py FAILED                                                                      [100%]
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_use_gmt_times <- pyftpdlib/test/test_functional.py ERROR                                                                       [100%]

===================================================================================================== ERRORS ======================================================================================================
_________________________________________________________________________ ERROR at teardown of TestConfigurableOptions.test_use_gmt_times _________________________________________________________________________

self = <pyftpdlib.test.test_functional.TestConfigurableOptions testMethod=test_use_gmt_times>

    def tearDown(self):
        if self.client is not None:
            close_client(self.client)
        # set back options to their original value
        if self.server is not None:
            self.server.server.max_cons = 0
            self.server.server.max_cons_per_ip = 0
            self.server.handler.banner = "pyftpdlib ready."
            self.server.handler.max_login_attempts = 3
            self.server.handler.auth_failed_timeout = 5
            self.server.handler.masquerade_address = None
            self.server.handler.masquerade_address_map = {}
            self.server.handler.permit_privileged_ports = False
            self.server.handler.permit_foreign_addresses = False
            self.server.handler.passive_ports = None
            self.server.handler.use_gmt_times = True
            self.server.handler.tcp_no_delay = hasattr(socket, 'TCP_NODELAY')
>           self.server.stop()

pyftpdlib/test/test_functional.py:1599: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyftpdlib/test/__init__.py:376: in stop
    assert_free_resources()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def assert_free_resources():
        ts = threading.enumerate()
        assert len(ts) == 1, ts
        p = psutil.Process()
        children = p.children()
>       assert not children, children
E       AssertionError: [psutil.Process(pid=22510, name='pytest', started='15:55:14')]

pyftpdlib/test/__init__.py:258: AssertionError
_________________________________________________________________________ ERROR at teardown of TestConfigurableOptions.test_use_gmt_times _________________________________________________________________________

self = <pyftpdlib.test.test_functional.TestConfigurableOptions testMethod=test_use_gmt_times>

    def tearDown(self):
        if self.client is not None:
            close_client(self.client)
        # set back options to their original value
        if self.server is not None:
            self.server.server.max_cons = 0
            self.server.server.max_cons_per_ip = 0
            self.server.handler.banner = "pyftpdlib ready."
            self.server.handler.max_login_attempts = 3
            self.server.handler.auth_failed_timeout = 5
            self.server.handler.masquerade_address = None
            self.server.handler.masquerade_address_map = {}
            self.server.handler.permit_privileged_ports = False
            self.server.handler.permit_foreign_addresses = False
            self.server.handler.passive_ports = None
            self.server.handler.use_gmt_times = True
            self.server.handler.tcp_no_delay = hasattr(socket, 'TCP_NODELAY')
>           self.server.stop()

pyftpdlib/test/test_functional.py:1599: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyftpdlib/test/__init__.py:376: in stop
    assert_free_resources()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def assert_free_resources():
        ts = threading.enumerate()
        assert len(ts) == 1, ts
        p = psutil.Process()
        children = p.children()
>       assert not children, children
E       AssertionError: [psutil.Process(pid=22510, name='pytest', started='15:55:14')]

pyftpdlib/test/__init__.py:258: AssertionError
_____________________________________________________________________ ERROR at teardown of TestConfigurableOptionsTLSMixin.test_use_gmt_times _____________________________________________________________________

self = <pyftpdlib.test.test_functional_ssl.TestConfigurableOptionsTLSMixin testMethod=test_use_gmt_times>

    def tearDown(self):
        if self.client is not None:
            close_client(self.client)
        # set back options to their original value
        if self.server is not None:
            self.server.server.max_cons = 0
            self.server.server.max_cons_per_ip = 0
            self.server.handler.banner = "pyftpdlib ready."
            self.server.handler.max_login_attempts = 3
            self.server.handler.auth_failed_timeout = 5
            self.server.handler.masquerade_address = None
            self.server.handler.masquerade_address_map = {}
            self.server.handler.permit_privileged_ports = False
            self.server.handler.permit_foreign_addresses = False
            self.server.handler.passive_ports = None
            self.server.handler.use_gmt_times = True
            self.server.handler.tcp_no_delay = hasattr(socket, 'TCP_NODELAY')
>           self.server.stop()

pyftpdlib/test/test_functional.py:1599: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyftpdlib/test/__init__.py:376: in stop
    assert_free_resources()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def assert_free_resources():
        ts = threading.enumerate()
        assert len(ts) == 1, ts
        p = psutil.Process()
        children = p.children()
>       assert not children, children
E       AssertionError: [psutil.Process(pid=22510, name='pytest', started='15:55:14')]

pyftpdlib/test/__init__.py:258: AssertionError
==================================================================================================== FAILURES =====================================================================================================
___________________________________________________________________________________ TestConfigurableOptions.test_use_gmt_times ____________________________________________________________________________________

self = <pyftpdlib.test.test_functional.TestConfigurableOptions testMethod=test_use_gmt_times>

    @retry_on_failure()
    def test_use_gmt_times(self):
        # use GMT time
        self.server = self.server_class()
        self.server.handler.use_gmt_times = True
        self.server.start()
        self.connect()
        gmt1 = self.client.sendcmd('mdtm ' + TESTFN)
        gmt2 = self.client.sendcmd('mlst ' + TESTFN)
        gmt3 = self.client.sendcmd('stat ' + TESTFN)
    
        # use local time
>       self.tearDown()

pyftpdlib/test/test_functional.py:1752: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyftpdlib/test/test_functional.py:1599: in tearDown
    self.server.stop()
pyftpdlib/test/__init__.py:376: in stop
    assert_free_resources()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def assert_free_resources():
        ts = threading.enumerate()
        assert len(ts) == 1, ts
        p = psutil.Process()
        children = p.children()
>       assert not children, children
E       AssertionError: [psutil.Process(pid=22510, name='pytest', started='15:55:14')]

pyftpdlib/test/__init__.py:258: AssertionError
___________________________________________________________________________________ TestConfigurableOptions.test_use_gmt_times ____________________________________________________________________________________

self = <pyftpdlib.test.test_functional.TestConfigurableOptions testMethod=test_use_gmt_times>

    @retry_on_failure()
    def test_use_gmt_times(self):
        # use GMT time
        self.server = self.server_class()
        self.server.handler.use_gmt_times = True
        self.server.start()
        self.connect()
        gmt1 = self.client.sendcmd('mdtm ' + TESTFN)
        gmt2 = self.client.sendcmd('mlst ' + TESTFN)
        gmt3 = self.client.sendcmd('stat ' + TESTFN)
    
        # use local time
>       self.tearDown()

pyftpdlib/test/test_functional.py:1752: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyftpdlib/test/test_functional.py:1599: in tearDown
    self.server.stop()
pyftpdlib/test/__init__.py:376: in stop
    assert_free_resources()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def assert_free_resources():
        ts = threading.enumerate()
        assert len(ts) == 1, ts
        p = psutil.Process()
        children = p.children()
>       assert not children, children
E       AssertionError: [psutil.Process(pid=22510, name='pytest', started='15:55:14')]

pyftpdlib/test/__init__.py:258: AssertionError
_______________________________________________________________________________ TestConfigurableOptionsTLSMixin.test_use_gmt_times ________________________________________________________________________________

self = <pyftpdlib.test.test_functional_ssl.TestConfigurableOptionsTLSMixin testMethod=test_use_gmt_times>

    @retry_on_failure()
    def test_use_gmt_times(self):
        # use GMT time
        self.server = self.server_class()
        self.server.handler.use_gmt_times = True
        self.server.start()
        self.connect()
        gmt1 = self.client.sendcmd('mdtm ' + TESTFN)
        gmt2 = self.client.sendcmd('mlst ' + TESTFN)
        gmt3 = self.client.sendcmd('stat ' + TESTFN)
    
        # use local time
>       self.tearDown()

pyftpdlib/test/test_functional.py:1752: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyftpdlib/test/test_functional.py:1599: in tearDown
    self.server.stop()
pyftpdlib/test/__init__.py:376: in stop
    assert_free_resources()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def assert_free_resources():
        ts = threading.enumerate()
        assert len(ts) == 1, ts
        p = psutil.Process()
        children = p.children()
>       assert not children, children
E       AssertionError: [psutil.Process(pid=22510, name='pytest', started='15:55:14')]

pyftpdlib/test/__init__.py:258: AssertionError
================================================================================ 3 failed, 767 deselected, 3 error in 0.99 seconds ================================================================================
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/multiprocessing/popen_fork.py", line 28, in poll
    pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt

@mjeveritt mjeveritt changed the title test_use_gmt_times fails on python 2.7 test_use_gmt_times fails with GMT[+1] timezones Sep 20, 2018
@mjeveritt
Copy link
Author

Per https://bugs.gentoo.org/666623#c5 , setting TZ=GMT+1 seems to fix this:

# TZ=GMT+1 pytest -k test_use_gmt_times -vv
==================================================== test session starts =====================================================
platform linux2 -- Python 2.7.12, pytest-3.0.3, py-1.4.30, pluggy-0.4.0 -- /usr/bin/python2.7
cachedir: .cache
rootdir: /mnt/Files/pyftpdlib, inifile:
plugins: hypothesis-3.6.0
collected 764 items

pyftpdlib/test/test_functional.py::TestConfigurableOptions::test_use_gmt_times <- pyftpdlib/test/__init__.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptions::test_use_gmt_times <- pyftpdlib/test/__init__.py PASSED
pyftpdlib/test/test_functional_ssl.py::TestConfigurableOptionsTLSMixin::test_use_gmt_times <- pyftpdlib/test/__init__.py PASSED

==================================================== 761 tests deselected ====================================================
========================================== 3 passed, 761 deselected in 3.39 seconds ==========================================

@mjeveritt
Copy link
Author

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

No branches or pull requests

2 participants