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

Anyone else seeing this test failure from time to time? #2580

Closed
msabramo opened this issue Mar 19, 2015 · 9 comments
Closed

Anyone else seeing this test failure from time to time? #2580

msabramo opened this issue Mar 19, 2015 · 9 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@msabramo
Copy link
Contributor

I periodically get this test failure and I don't know yet whether it's due to a misconfiguration on my system (though ideally tests should be isolated from that?) or a general problem in pip or the test suite.

=================================================================================== FAILURES ===================================================================================
_______________________________________________________________________ test_install_package_with_target _______________________________________________________________________
tests/functional/test_install.py:568: in test_install_package_with_target
    assert Path('scratch') / 'target' / 'six.py' in result.files_updated, (
E   AssertionError: Script result: pip install -t /private/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/pytest-917/test_install_package_with_target0/workspace/scratch/target --upgrade six
E     -- stdout: --------------------
E     Collecting six
E       Using cached six-1.9.0-py2.py3-none-any.whl
E     Installing collected packages: six
E     Successfully installed six
E
E   assert ((Path(u'scratch') / 'target') / 'six.py') in {}
E    +  where Path(u'scratch') = Path('scratch')
E    +  and   {} = <tests.lib.TestPipResult object at 0x104e7d4d0>.files_updated
==================================================================== 1 failed, 43 passed in 255.51 seconds =====================================================================

Anyone else seeing this?

@msabramo
Copy link
Contributor Author

Basically, most of the time result.files_updated is a dict with 9 items, but sometimes it is an empty dict. And just now I ran it and got a dict with 3 items.

Me thinks something is wrong with scripttest perhaps...?

@msabramo
Copy link
Contributor Author

Hmmmm. This seems baaad.

(Pdb++) f = files_before['venv/lib/python2.7/site-packages/pip-6.1.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/packages/six.py']
(Pdb++) f.path
u'venv/lib/python2.7/site-packages/pip-6.1.0.dev0-py2.7.egg/pip/operations/__init__.py'

@msabramo
Copy link
Contributor Author

Is that test even right?

    # Test install and upgrade of single-module package
    result = script.pip('install', '-t', target_dir, 'six')
    assert Path('scratch') / 'target' / 'six.py' in result.files_created, (
        str(result)
    )

    result = script.pip('install', '-t', target_dir, '--upgrade', 'six')
    assert Path('scratch') / 'target' / 'six.py' in result.files_updated, (
        str(result)
    )

Why is it expected that six.py would be updated, since we just installed it and the upgrade most likely would do nothing and size and hash of that file would be the same? (Unless a new version of six appeared between these two stanzas, which seems very rare).

@msabramo
Copy link
Contributor Author

Oh maybe it depends on the mtime being incremented and when the test runs quickly enough, perhaps it doesn't change.

@msabramo
Copy link
Contributor Author

Just did some pdb and I think it's the mtime thing. When f != files_after[path]:

(Pdb++) self.mtime, other.mtime
(1426789239.0, 1426789240.0)

@msabramo
Copy link
Contributor Author

The test passes when the mtimes are not equal:

*** files_before['scratch/target/six.py'].mtime = 1426790160.0
*** files_after['scratch/target/six.py'].mtime = 1426790161.0

and fails when the mtimes are equal:

*** files_before['scratch/target/six.py'].mtime = 1426790092.0
*** files_after['scratch/target/six.py'].mtime = 1426790092.0
...
tests/functional/test_install.py:570: in test_install_package_with_target
    assert Path('scratch') / 'target' / 'six.py' in result.files_updated, (
E   AssertionError: Script result: pip install -t /private/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/pytest-990/test_install_package_with_target0/workspace/scratch/target --upgrade six
E     -- stdout: --------------------
E     Collecting six
E       Using cached six-1.9.0-py2.py3-none-any.whl
E     Installing collected packages: six
E     Successfully installed six
E
E   assert ((Path(u'scratch') / 'target') / 'six.py') in {}
E    +  where Path(u'scratch') = Path('scratch')
E    +  and   {} = <tests.lib.TestPipResult object at 0x10575ec90>.files_updated

@msabramo
Copy link
Contributor Author

#2583 should fix this issue, because I made it install six==1.8.0 and then install six==1.9.0, so it's guaranteed that the file hash will change and it's not relying on the mtime update.

@msabramo
Copy link
Contributor Author

#2583 updated to no longer use six. It now uses a simple one module package to avoid bloat.

msabramo added a commit to msabramo/pip that referenced this issue Mar 23, 2015
and also fix intermittent failures reported in
pypa#2580
@msabramo
Copy link
Contributor Author

Fixed by #2583

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

1 participant