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

Packaging flask-mongoengine for Debian #219

Closed
oorestisime opened this issue Mar 24, 2016 · 9 comments
Closed

Packaging flask-mongoengine for Debian #219

oorestisime opened this issue Mar 24, 2016 · 9 comments

Comments

@oorestisime
Copy link

Hello,

I ve started packaging flask-mongoengine. I noticed that the license is probably a bit old since it says 2010-2012. I guess you might want to pump this up.

Anyhow the issue i have is with tests. I can't seem to run them. I am sure I am going something wrong at the point "ensure you are running a local copy of Flask-MongoEngine". Can you possibly tell me what I have to run before doing python setup.py nosetests?

Cheers,

Orestis

@lafrech
Copy link
Member

lafrech commented Mar 25, 2016

Hi @oorestisime.

I ve started packaging flask-mongoengine.

Great. Thanks for this. Anything you need, please ask.

I noticed that the license is probably a bit old since it says 2010-2012. I guess you might want to pump this up.

Done: 60f8704

Anyhow the issue i have is with tests. I can't seem to run them. I am sure I am going something wrong at the point "ensure you are running a local copy of Flask-MongoEngine". Can you possibly tell me what I have to run before doing python setup.py nosetests?

Works for me. What did you try and what did you get?

Basically, I would create a virtualenv in which I'd install all dependencies (easiest is probably to fetch flask-mongoengine itself from pip so that it pulls all the rest in). Then, in the VE,

python setup.py nosetests

I don't think I had to do anything special.

Not sure if/how test dependencies are automatically added (rednose, etc.). Might be worth checking and maybe installing them manually (pip or apt-get).

Don't you have an explicit error message?

@oorestisime
Copy link
Author

Here's the stacktrace

 Traceback (most recent call last):
    tests/test_basic_app.py line 22 in setUp
      Todo.drop_collection()
    build/bdist.linux-x86_64/egg/mongoengine/document.py line 673 in drop_collection
      db.drop_collection(cls._get_collection_name())
    build/bdist.linux-x86_64/egg/pymongo/database.py line 553 in drop_collection
      self.command("drop", _unicode(name), allowable_errors=["ns not found"])
    build/bdist.linux-x86_64/egg/pymongo/database.py line 478 in command
      with client._socket_for_reads(read_preference) as (sock_info, slave_ok):
    /usr/lib/python2.7/contextlib.py line 17 in __enter__
      return self.gen.next()
    build/bdist.linux-x86_64/egg/pymongo/mongo_client.py line 752 in _socket_for_reads
      with self._get_socket(read_preference) as sock_info:
    /usr/lib/python2.7/contextlib.py line 17 in __enter__
      return self.gen.next()
    build/bdist.linux-x86_64/egg/pymongo/mongo_client.py line 716 in _get_socket
      server = self._get_topology().select_server(selector)
    build/bdist.linux-x86_64/egg/pymongo/topology.py line 142 in select_server
      address))
    build/bdist.linux-x86_64/egg/pymongo/topology.py line 118 in select_servers
      self._error_message(selector))
   ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused

Do i need to run mongod for tests?

@lafrech
Copy link
Member

lafrech commented Mar 25, 2016

OK same here. I never saw that because I always had a mongod instance running.

There were recent commits about using mongomock so there should be a way to test without mongod.

Is running the automatic tests part of the build process in Debian? I mean, is it mandatory? I'm just asking, not suggesting we should skip this, especially since everything is in place.

@oorestisime
Copy link
Author

It is not mandatory but I'd like to include them since they can help find bugs of installation. There are a lot of instances checking the installations of packages and having the tests would help make sure that the package is correctly installed and healthy.

This is the reason i picked the github tarball instead of the pypi one (you exclude tests there).

I can try to launch mongod during tests and see if that works although i think that mongomock would be a better solution so if you can point me to the way to test without mongod i would really appreciate.

This is the only blocker :)

@lafrech
Copy link
Member

lafrech commented Mar 25, 2016

@oorestisime, for a status of flask-ME, see #71.

We're about to release 0.8. The last missing piece is a development around mongomock @losintikfos is working on: #98. If I understand correctly, once this is done, tests will automatically use mongomock, thus won't need a mongod instance.

For now, there could be a way to specify it manually. I've just had a quick try, fiddling with tests/__init__.py, but to no avail. It might be obvious for someone with prior knowledge about mongomock, though. But it might not be worth the pain if #98 is coming soon.

Debian packaging is a great opportunity for the project, so I think this is yet another incentive to get this mongomock integration.

@oorestisime
Copy link
Author

Ok great :)
I guess i ll wait for 0.8 then.

Thanks again for all the help!

@oorestisime
Copy link
Author

hello folks, any updates here? given that the freeze for the next release is on November i'd like to know if there's any chance for this to be done before that so i could actually upload a package.
I am not sure if i could help with any dev here, i am open to suggestions :)

@lafrech
Copy link
Member

lafrech commented Dec 14, 2016

Just stumbled upon this old conversation.

Mongomock support has been removed from flask-mongoengine, so it won't save you.

How do you deal with Mongoengine tests? Mongomock?

Maybe have a look at other MongoDB related packages (pymongo) to see how they run their tests.

@insspb
Copy link
Collaborator

insspb commented Jun 8, 2020

Outdated, have no sense now.

@insspb insspb closed this as completed Jun 8, 2020
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

3 participants