Opened 3 years ago

Closed 3 years ago

#32626 closed Bug (needsinfo)

TypeError while using Selenium with Django 3.2

Reported by: Fabrice Jaouën Owned by: nobody
Component: Testing framework Version: 3.2
Severity: Normal Keywords: Posixpath Selenium
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,
I'm developing a Django project and a puzzling error has popped up, while using Selenium.

  • The Selenium tests run smoothly and pass, despite this error message
  • The unitary tests as well.
  • When I launch the server, the project runs fine, as well...

Here is the Selenium starting point:

class CustomUserTest(LiveServerTestCase):
    fixtures = ['users.json']

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
        cls.browser = Firefox()
        cls.browser.implicitly_wait(10)

    @classmethod
    def tearDownClass(cls):
        cls.browser.quit()
        super().tearDownClass()

    def test_plaid_10_authenticate_on_the_website(self):
        self.browser.get(os.path.join(self.live_server_url, ''))

There is only a puzzling error message, which does not seem being related to my project, as everything else is ok.
Here is an excerpts of the issue:

  File "Users/myname/Documents/myfolder/myproject/venv/lib/python3.7/site-packages/django/test/testcases.py", line 1417, in serve
    return serve(request, final_rel_path, document_root=self.get_base_dir())
  File "Users/myname/Documents/myfolder/myproject/venv/lib/python3.7/site-packages/django/views/static.py", line 36, in serve
    fullpath = Path(safe_join(document_root, path))
  File "Users/myname/Documents/myfolder/myproject/venv/lib/python3.7/site-packages/django/utils/_os.py", line 17, in safe_join
    final_path = abspath(join(base, *paths))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/posixpath.py", line 80, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
[09/Apr/2021 07:13:07,948] - Broken pipe from ('127.0.0.1', 54981)

Here is a copy of my requirements.txt:

asgiref==3.3.4
certifi==2020.12.5
chardet==4.0.0
coverage==5.5
Django==3.2
django-registration-redux==2.9
idna==2.10
psycopg2==2.8.6
python-dotenv==0.15.0
pytz==2021.1
requests==2.25.1
selenium==3.141.0
sqlparse==0.4.1
typing-extensions==3.7.4.3
urllib3==1.26.4

Hope this bug may raise your interest !
Kind regards.
Fabrice

Change History (1)

comment:1 by Mariusz Felisiak, 3 years ago

Resolution: needsinfo
Status: newclosed

Thanks for this report, however I don't think you've explained the issue in enough detail to confirm a bug in Django. Please reopen the ticket if you can debug your issue and provide more details or a sample project.

Note: See TracTickets for help on using tickets.
Back to Top