MarketSquare / MarketSquare/robotframework-faker

Importing test library 'FakerLibrary' failed: AttributeError: 'PosixPath' object has no attribute 'startswith'

Open
#71 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
69
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Python:3.8.10,robotframework-faker=5.0.0, import to RIDE

20210616 10:14:24.262 [WARN]: Importing test library "FakerLibrary" failed

Traceback (most recent call last):
Importing test library 'FakerLibrary' failed: AttributeError: 'PosixPath' object has no attribute 'startswith'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/robotide/lib/robot/utils/importer.py", line 153, in _import
return __import__(name, fromlist=fromlist)
File "/Users/ming.ni/Library/Python/3.8/lib/python/site-packages/FakerLibrary/__init__.py", line 2, in
from .keywords import FakerKeywords
File "/Users/ming.ni/Library/Python/3.8/lib/python/site-packages/FakerLibrary/keywords.py", line 10, in
import faker.factory
File "/Users/ming.ni/Library/Python/3.8/lib/python/site-packages/faker/__init__.py", line 1, in
from faker.factory import Factory
File "/Users/ming.ni/Library/Python/3.8/lib/python/site-packages/faker/factory.py", line 7, in
from faker.config import AVAILABLE_LOCALES, DEFAULT_LOCALE, PROVIDERS
File "/Users/ming.ni/Library/Python/3.8/lib/python/site-packages/faker/config.py", line 11, in
PROVIDERS = find_available_providers(
File "/Users/ming.ni/Library/Python/3.8/lib/python/site-packages/faker/utils/loading.py", line 57, in find_available_providers
for mod in list_module(providers_mod) if mod != '__pycache__'
File "/Users/ming.ni/Library/Python/3.8/lib/python/site-packages/faker/utils/loading.py", line 35, in list_module
return [name for _, name, is_pkg in pkgutil.iter_modules([path]) if is_pkg]
File "/Users/ming.ni/Library/Python/3.8/lib/python/site-packages/faker/utils/loading.py", line 35, in
return [name for _, name, is_pkg in pkgutil.iter_modules([path]) if is_pkg]
File "/usr/local/Cellar/python@3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 129, in iter_modules
for i in importers:
File "/usr/local/Cellar/python@3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pkgutil.py", line 419, in get_importer
importer = path_hook(path_item)
File "", line 1594, in path_hook_for_FileFinder
File "", line 1469, in __init__
File "", line 177, in _path_isabs
PYTHONPATH:
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/Users/ming.ni/Documents/testframework/Resources
/Users/ming.ni/Documents
/usr/local/bin
/usr/local/Cellar/python@3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python38.zip
/usr/local/Cellar/python@3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8
/usr/local/Cellar/python@3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload
/Users/ming.ni/Library/Python/3.8/lib/python/site-packages
/usr/local/lib/python3.8/site-packages
/usr/local/lib/python3.8/site-packages/robotide/spec
/usr/local/lib/python3.8/site-packages/robotide/lib
/usr/local/lib/python3.8/site-packages/robotide/contrib/testrunner/../../lib
/usr/local/lib/python3.8/site-packages/robotide/contrib/testrunner/../../lib
File "/usr/local/lib/python3.8/site-packages/robotide/spec/librarymanager.py", line 82, in _fetch_keywords
return get_import_result(path, library_args)
File "/usr/local/lib/python3.8/site-packages/robotide/spec/libraryfetcher.py", line 21, in get_import_result
lib = robotapi.TestLibrary(path, args)
File "/usr/local/lib/python3.8/site-packages/robotide/lib/robot/running/testlibraries.py", line 49, in TestLibrary
libcode, source = importer.import_class_or_module(import_name,
File "/usr/local/lib/python3.8/site-packages/robotide/lib/robot/utils/importer.py", line 72, in import_class_or_module
self._raise_import_failed(name, err)
File "/usr/local/lib/python3.8/site-packages/robotide/lib/robot/utils/importer.py", line 109, in _raise_import_failed
raise DataError('\n'.join(msg))

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the import with Python 3.8.10, robotframework-faker 5.0.0, and RIDE. Start with the reported path handling in faker/utils/loading.py and the import flow through robotide/spec/libraryfetcher.py; done means FakerLibrary imports without the PosixPath/startswith error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.