jpvanhal / flask-basicauth

HTTP basic access authentication for Flask.
https://flask-basicauth.readthedocs.io/
Other
85 stars 27 forks source link

Unable to run tests - dependency issue #28

Open mdavis-xyz opened 4 years ago

mdavis-xyz commented 4 years ago

I'm trying to run the unit tests, so that I can write a PR.

I can't figure out how. There's no requirements.txt or requirements_test.txt.

setup.py only specifies Flask as a dependency, and no test dependencies.

If I install Flask and run python3 setup.py test, it says:

ModuleNotFoundError: No module named 'flask.ext'

So are the dependencies in setup.py missing something? What do I pip install? Flask-Ext? That library has 1 contributor, no stars, no forks, no issues. Is that the right one?

sandrotosi commented 3 years ago

i think there has been a code reorg at some point (from flask.ext.basicauth to flask_basicauth) and not all places have been updated. I'm apply think patch and it seems to do what we expect (anyone can submit a pr with this code, attribution is not important to me):

--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -* coding: utf-8 -*-
 #
 # Flask-BasicAuth documentation build configuration file, created by
 # sphinx-quickstart on Sun Apr 29 21:12:20 2012.
@@ -13,7 +13,7 @@

 import sys, os

-from flask.ext.basicauth import __version__
+from flask_basicauth import __version__

 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -22,7 +22,7 @@ Usage
 Usage of Flask-BasicAuth is simple::

     from flask import Flask, render_template
-    from flask.ext.basicauth import BasicAuth
+    from flask_basicauth import BasicAuth

     app = Flask(__name__)

@@ -77,14 +77,14 @@ A list of configuration keys currently u
     The correct username and password combination that grants access for the
     client to the protected resource.

-    You can override :meth:`BasicAuth.check_credentials <flask.ext.basicauth.BasicAuth.check_credentials>`,
+    You can override :meth:`BasicAuth.check_credentials <flask_basicauth.BasicAuth.check_credentials>`,
     if you need a different authentication logic for your application.

 API reference
 -------------

-.. module:: flask.ext.basicauth
+.. module:: flask_basicauth

 This part of the documentation covers all the public classes and functions
 in Flask-BasicAuth.
--- a/flask_basicauth.py
+++ b/flask_basicauth.py
@@ -1,5 +1,5 @@
 """
-    flask.ext.basicauth
+    flask_basicauth
     ~~~~~~~~~~~~~~~~~~~

     Flask-BasicAuth is a Flask extension that provides an easy way to protect
--- a/test_basicauth.py
+++ b/test_basicauth.py
@@ -2,7 +2,7 @@ import base64
 import unittest

 from flask import Flask
-from flask.ext.basicauth import BasicAuth
+from flask_basicauth import BasicAuth

 class BasicAuthTestCase(unittest.TestCase):