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_main_module_paths fails on RHEL and Ubuntu when using Amazon EC2 #1879

Closed
karlw00t opened this Issue Jun 3, 2016 · 8 comments

Comments

Projects
None yet
5 participants
@karlw00t
Contributor

karlw00t commented Jun 3, 2016

Running the unit tests against HEAD (e048aa4), I'm able to reproduce a single failing unit tests in:

tests/test_instance_config.py::test_main_module_paths

I'm able to reproduce the bug on Amazon Linux 2016.03.1 and RHEL 7.2. I'm running on a fresh EC2 instance in both cases, and the steps to reproduce are the same, here is my bash history:

sudo yum install python-virtualenv
sudo yum groupinstall 'Development Tools'
virtualenv flask
cd flask/
git clone https://github.com/pallets/flask.git
cd flask/
source ../bin/activate
pip install -e .
pip install -r test-requirements.txt
py.test tests/test_instance_config.py::test_main_module_paths

failing output:

modules_tmpdir = local('/tmp/pytest-of-ec2-user/pytest-0/test_main_module_paths0/modules_tmpdir'), purge_module = <function inner at 0x170c1b8>

def test_main_module_paths(modules_tmpdir, purge_module):
    app = modules_tmpdir.join('main_app.py')
    app.write('import flask\n\napp = flask.Flask("__main__")')
    purge_module('main_app')

    from main_app import app
    here = os.path.abspath(os.getcwd())
  assert app.instance_path == os.path.join(here, 'instance')

E assert '/home/ec2-us...r/py-instance' == '/home/ec2-use...lask/instance'
E - /home/ec2-user/flask/var/py-instance
E ? ^ ^ ---
E + /home/ec2-user/flask/flask/instance
E ? ^^ ^^

tests/test_instance_config.py:33: AssertionError

This test seems to be passing fine on Travis, and on Debian and OSX. It appears to be a Redhat/Amazon Linux specific issue. I ran git bisect back to commits on May 26th, 2016 and the test still fails all attempts.

@untitaker

This comment has been minimized.

Member

untitaker commented Jun 3, 2016

I'm sorry, but what am I supposed to do?

@untitaker

This comment has been minimized.

Member

untitaker commented Jun 3, 2016

Are you sure that you installed Flask on both machines the same way? What are the respective setuptools, pip and Python versions?

@jeffwidman

This comment has been minimized.

Member

jeffwidman commented Jun 3, 2016

Sorry, I should have added context. This is a Pycon sprinter who hit this issue and works at Amazon. While the root cause is likely upstream, there is a small chance it's something we can change in a non-hacky way. Since he'd done all the research and had a clearly reproducible test case, I suggested he add it to the tracker so that we can let it float a little and see if anyone else has a suggested fix, especially because if it turns out to be an amazon issue he can push it forward internally. So I'd just let this float for a bit and if no one else hits it we can close it down the road.

@karlw00t

This comment has been minimized.

Contributor

karlw00t commented Jun 3, 2016

I ran this on Ubuntu (trusty-14.04) on an EC2 instance as well and was able to reproduce this:

sudo apt install build-essential
sudo apt install python-virtualenv
virtualenv flask
cd flask/
source bin/activate
sudo apt install git
git clone https://github.com/pallets/flask.git
cd flask/
pip install -e .
pip install -r test-requirements.txt
py.test

The error that I'm getting is in the same function, same line.

@karlw00t

This comment has been minimized.

Contributor

karlw00t commented Jun 3, 2016

Version numbers from the Ubuntu host:

(flask)ubuntu@ip-172-31-12-20:/flask/flask$ pip --version
pip 1.5.4 from /home/ubuntu/flask/local/lib/python2.7/site-packages (python 2.7)
(flask)ubuntu@ip-172-31-12-20:
/flask/flask$ python --version
Python 2.7.6
(flask)ubuntu@ip-172-31-12-20:~/flask/flask$ python -m easy_install --version
setuptools 2.2

@jeffwidman jeffwidman added question and removed question labels Jun 4, 2016

@jeffwidman jeffwidman changed the title from test_main_module_paths fails on RHEL to test_main_module_paths fails on RHEL and Ubuntu when using Amazon EC2 Jun 4, 2016

@davidism

This comment has been minimized.

Member

davidism commented Sep 21, 2016

#2035 jogged my memory of and old issue I helped someone debug. The env should be inside the project, but you've checked out the project inside the env. This makes Flask think that it's installed rather than running locally. The test doesn't expect the project to appear to be installed.

@davidism davidism closed this Sep 21, 2016

@begueradj

This comment has been minimized.

begueradj commented May 11, 2017

I have this same problem (test_instance_config.py:33: AssertionError) with the current Flask version. Environment is:

  • Ubuntu 16.04 LTS
  • Python 3.5.2
  • pytest version 3.0.7

ls inside the virtual environment outputs this: ls bin flask include lib pip-selfcheck.json
How to fix this?

@davidism

This comment has been minimized.

Member

davidism commented May 11, 2017

Don't put the flask dir in your env dir, put your env dir in the flask dir (or completely separate). Actually, that's literally what I said in the previous comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment