Pytest fails on Travis: cannot find main package - travis-ci

I recently made a large swath of changes to a Python 3 project on Github, largely documentation and docstrings.
The tests pass locally, but when I push the branch to Github, Travis CI fails:
$ pytest
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/_pytest/config.py", line 342, in _getconftestmodules
return self._path2confmods[path]
KeyError: local('/home/travis/build/scossu/lakesuperior')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/_pytest/config.py", line 373, in _importconftest
return self._conftestpath2mod[conftestpath]
KeyError: local('/home/travis/build/scossu/lakesuperior/conftest.py')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/_pytest/config.py", line 379, in _importconftest
mod = conftestpath.pyimport()
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/py/_path/local.py", line 668, in pyimport
__import__(modname)
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/_pytest/assertion/rewrite.py", line 212, in load_module
py.builtin.exec_(co, mod.__dict__)
File "/home/travis/build/scossu/lakesuperior/conftest.py", line 6, in <module>
from lakesuperior.config_parser import test_config
ImportError: No module named 'lakesuperior.config_parser'
ERROR: could not load /home/travis/build/scossu/lakesuperior/conftest.py
The command "pytest" exited with 4.
lakesuperior is the main application package.
My .travis.yml:
language: python
python:
- "3.5"
- "3.6"
install:
- pip install -r requirements.txt
- coilmq&
script:
- pytest tests
The only thing that I think may have affected the import issue is that I added some __init__.py files to subpackages in order for Sphinx to discover API docs. I am not sure how that may have messed up CI though.
I verified that the previous commit passes all tests as it used to.
Has anybody encountered this scenario before? Any hints?
Thanks.

I recently had the same issue. I fixed it by removing the __init__.py file from the top level directory. See here.

Related

Python test fails printing dependency on local package

I thought that bazel runs tests in sandbox, but recently I got an error pointing to a local module /usr/lib/python3/dist-packages/OpenSSL/SSL.py. It it correct? How to make bazel run in a sandbox?
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //master:master_impl_test
-----------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/agent/.cache/bazel/_bazel_agent/374e3bc824f25540df2be790dbb8f41e/sandbox/linux-sandbox/1/execroot/__main__/bazel-out/k8-fastbuild/bin/master/master_impl_test.runfiles/__main__/master/master_impl_test.py", line 14, in <module>
from master import master_impl
File "/home/agent/.cache/bazel/_bazel_agent/374e3bc824f25540df2be790dbb8f41e/sandbox/linux-sandbox/1/execroot/__main__/bazel-out/k8-fastbuild/bin/master/master_impl_test.runfiles/__main__/master/master_impl.py", line 20, in <module>
from azure.cosmos import cosmos_client
File "/home/agent/.cache/bazel/_bazel_agent/374e3bc824f25540df2be790dbb8f41e/sandbox/linux-sandbox/1/execroot/__main__/bazel-out/k8-fastbuild/bin/master/master_impl_test.runfiles/py_deps/pypi__azure_cosmos/azure/cosmos/cosmos_client.py", line 25, in <module>
import requests
File "/home/agent/.cache/bazel/_bazel_agent/374e3bc824f25540df2be790dbb8f41e/sandbox/linux-sandbox/1/execroot/__main__/bazel-out/k8-fastbuild/bin/master/master_impl_test.runfiles/py_deps/pypi__requests/requests/__init__.py", line 95, in <module>
from urllib3.contrib import pyopenssl
File "/home/agent/.cache/bazel/_bazel_agent/374e3bc824f25540df2be790dbb8f41e/sandbox/linux-sandbox/1/execroot/__main__/bazel-out/k8-fastbuild/bin/master/master_impl_test.runfiles/py_deps/pypi__urllib3/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 675, in <module>
_lib.Cryptography_HAS_TLSEXT_HOSTNAME, "SNI not available"
AttributeError: module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'
Today my project's CI get this error. I fixed this problem in my project, just upgrading pyOpenSSL library to latest version.
Old requirements-file.txt:
requests
pyOpenSSL==19.0.0
urllib3==1.25.3
New requirements-file.txt:
cffi==1.14.4
cryptography==3.3
pycparser==2.20
pyOpenSSL==20.0.0
six==1.15.0
urllib3==1.25.3

Unable to compile third-party package for iOS using Kivy toolchain

I am working on a small testing project and wanted to add Robot Remoteserver onto an iOS device but can't get toolchain to build the package successfully. Here's the errors I get when I attempt to build this package:
copying build/lib/robotremoteserver.py -> /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages
byte-compiling /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver.py to robotremoteserver.pyc
writing byte-compilation script '/tmp/tmpM9XgVf.py'
/Users/usman/kivy/kivy-ios/dist/hostpython/bin/python -OO /tmp/tmpM9XgVf.py
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
removing /tmp/tmpM9XgVf.py
running install_egg_info
Removing /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver-devel-py2.7.egg-info
Writing /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver-devel-py2.7.egg-info
Traceback (most recent call last):
File "./toolchain.py", line 1224, in <module>
ToolchainCL()
File "./toolchain.py", line 1040, in __init__
getattr(self, args.command)()
File "./toolchain.py", line 1064, in build
build_recipes(args.recipe, ctx)
File "./toolchain.py", line 933, in build_recipes
recipe.execute()
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 556, in execute
self.build_all()
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 56, in _cache_execution
f(self, *args, **kwargs)
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 668, in build_all
self.install()
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 56, in _cache_execution
f(self, *args, **kwargs)
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 794, in install
self.install_python_package()
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 835, in install_python_package
dest_dir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 171, in copytree
names = os.listdir(src)
OSError: [Errno 2] No such file or directory: '/Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver'
For the line Could not find platform dependent libraries I did set the PYTHONPATH but still had this error.
Since there's no template to follow for the build script, I viewed the build files for the packages kivy comes with and created one that contains the following
from toolchain import PythonRecipe
class RobotRemoteServer(PythonRecipe):
version = "master"
url = "https://github.com/robotframework/PythonRemoteServer/archive/{version}.zip"
depends = ["python"]
recipe = RobotRemoteServer()
I have ensured Kivy and the packages it depends on are all installed correctly. I've also searched the web but can't quite figure out what the problem is. I'm using Xcode 6.4 and latest kivy pull from git. I have been stuck on this for a few days and appreciate any help or guidance.
Kivy recipes follow the same format as those for python-for-android. Here you have the related documentation.

How to verify my docker-compose.yml?

I am setting up a container stack using docker-compose. Yet by running
docker-compose up
I get a rather cryptic error message:
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 9, in <module>
load_entry_point('docker-compose==1.4.2', 'console_scripts', 'docker-compose')()
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 39, in main
command.sys_dispatch()
File "/usr/local/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch
self.dispatch(sys.argv[1:], None)
File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 27, in dispatch
super(Command, self).dispatch(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 24, in dispatch
self.perform_command(*self.parse(argv, global_options))
File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 57, in perform_command
verbose=options.get('--verbose'))
File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 78, in get_project
config.load(config_details),
File "/usr/local/lib/python2.7/dist-packages/compose/config.py", line 138, in load
for service_name, service_dict in list(dictionary.items()):
AttributeError: 'NoneType' object has no attribute 'items'
How to debug? I have checked that the yml is valid, yet it doesn't work.
I forgot to save my docker-compose.yml, so it was empty.
I stumbled across the solution in this issue about making the error message better which was describing the behavior.
One gets a nice message if no docker-compose.yml exists at all:
Can't find a suitable configuration file in this directory or any parent. Are you in the right directory?
Supported filenames: docker-compose.yml, docker-compose.yaml, fig.yml, fig.yaml
It was anounced on the docker-compose's issue list that there will be a nicer error message in the upcomming 1.5 release:
Top level object needs to be a dictionary. Check your .yml file that
you have defined a service at the top level.
As of version 1.7.1 the error message indicating that your file is empty reads:
ERROR: Top level object in './docker-compose.yml' needs to be an
object not '<type 'NoneType'>'.
Given the latest versions, the error message is very straightforward:
$ docker -v
Docker version 19.03.13, build 4484c46d9d
$ docker build .
failed to solve with frontend dockerfile.v0: failed to create LLB definition: the Dockerfile cannot be empty
So for ease of use, consider upgrading your docker engine.

Telegram iOS app could't not run on Xcode

I have download the source code of Telegram app on their website:https://telegram.org/source.
When I try to run the project, there show an error like below:
UFW (M iphonesimulator): ERROR: Build failed
Traceback (most recent call last):
File "/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Intermediates/MtProtoKit.build/Debug-iphonesimulator/MtProtoKit iOS.build/Script-D05A831218AFB3F9007F1076.sh", line 812, in <module>
run_build()
File "/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Intermediates/MtProtoKit.build/Debug-iphonesimulator/MtProtoKit iOS.build/Script-D05A831218AFB3F9007F1076.sh", line 787, in run_build
add_symlinks_to_framework(project)
File "/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Intermediates/MtProtoKit.build/Debug-iphonesimulator/MtProtoKit iOS.build/Script-D05A831218AFB3F9007F1076.sh", line 675, in add_symlinks_to_framework
attempt_symlink(os.path.join(base_dir, "Versions", "Current"), os.environ['FRAMEWORK_VERSION'])
File "/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Intermediates/MtProtoKit.build/Debug-iphonesimulator/MtProtoKit iOS.build/Script-D05A831218AFB3F9007F1076.sh", line 493, in attempt_symlink
os.stat(os.path.abspath(os.path.join(link_path, "..", link_to)))
OSError: [Errno 2] No such file or directory: '/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Products/Debug-iphonesimulator/MtProtoKit iOS.framework/Versions/A'
Showing first 200 notices only
Command /bin/sh failed with exit code 1
I didn't change anything before I try to run the project.
Telegram uses currently retired project https://github.com/kstenerud/iOS-Universal-Framework
Install 'iOS-Universal-Framework' and with couple of additional fixes you will be able to build it.
OSError: [Errno 2] No such file or directory: '/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Products/Debug-iphonesimulator/MtProtoKit iOS.framework/Versions/A'
You are referencing to a third party library that isn't there.

Running html5 app template in ubuntu sdk failed?

My configuration :
Ubuntu 14.04 LTS
64bit
Qtcreator 3.1.1
everything is up-to-date
Hello everyone,
I'm trying to just compile and run an HTML5 App for ubuntu Phone, but after trying and searching for a week now, I still can't make it run !
For the moment I just want to run the simple html5 app template.
This is the situation :
I have installed ubuntu sdk as instructed in https://developer.ubuntu.com/en/start/ubuntu-sdk/installing-the-sdk/
I've created in the run click menu, an i386 build target. (15.04) --- which exited with no errors
I created an i386 emulator in devices --> i386 - devel - default password --- which is finally up and running correctly
The problem is when I compile the default template : theses are the errors I get :
desktop_Exec(app): found unexpected Exec with architecture 'all':./qtc_device_debughelper.py
security_policy_groups_safe_app(debug):(REJECT)reserved policy group 'debug':not for production use
security_policy_version_matches_framework(app.apparmor):invalid framework 'ubuntu-core-15.04'
And when I try to edit it anyway :
This is what I get :
Traceback (most recent call last):
File "/tmp/qtc_device_applaunch.py", line 29, in <module>
gi.Repository.get_default().require("UbuntuAppLaunch")
gi.RepositoryError: Typelib file for namespace 'UbuntuAppLaunch' (any version) not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2158, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/qtc_device_applaunch.py", line 33, in <module>
from gi.repository import UpstartAppLaunch as UAL
File "/usr/lib/python3/dist-packages/gi/importer.py", line 53, in find_module
'introspection typelib not found' % namespace)
ImportError: cannot import name UpstartAppLaunch, introspection typelib not found
I have been looking for this everywhere but I couldn't find something that works.
I need some of your knowledge to help me understand all this!
I have the same errors. I think that the 'ubuntu-core-15.04'-error is related to the version of Ubuntu you are using. I use Mint 17, which is based on Ubuntu 14.04. Canonical recommends the newer Ubuntu Versions for app-developing, because there is some stuff in it they changed.
unfortunately, I can't help you with the other errors.

Resources