When I try and run some basic unit tests on ruby using rake, it appears to turn debugging up on the ruby interpreter. This ends up with me seeing a ton of warning messages in STDOUT. I'm not sure why this is happening and if it should be?
D:\dev\git_repos\app_folder>ruby -v
ruby 2.0.0p647 (2015-08-18) [i386-mingw32]
D:\dev\git_repos\app_folder>rake test TEST=test/midrange_portal_test.rb
like 4 pages of warnings
output which leads me to believe debugging is turned up:
Command failed with status (2): [ruby -w -I"lib;test" -
I"D:/apps/Ruby200/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib"
"D:/apps/Ruby200/lib/ruby/gems/2.0.0/gems/rake-11.1.2/lib/rake/rake_test_loader.rb" "test/midrange_portal_test.rb" ]
D:\dev\git_repos\app_folder>gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14.1
- RUBY VERSION: 2.0.0 (2015-08-18 patchlevel 647) [i386-mingw32]
- INSTALLATION DIRECTORY: D:/apps/Ruby200/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: D:/apps/Ruby200/bin/ruby.exe
- EXECUTABLE DIRECTORY: D:/apps/Ruby200/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- D:/apps/Ruby200/lib/ruby/gems/2.0.0
- H:/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
Notice how the command is "ruby -w". I don't know why it defaults to this level of debugging? Any help would be greatly appreciated as I'm quite stumped.
So after a lot of digging it turns out the version of rake im using runs ruby with the -w flag by default. If you look in /gems/rake-11.1.2/lib/rake/testtask.rb there is a boolean which sets the ruby warning flag:
def initialize(name=:test)
#name = name
#libs = ["lib"]
#pattern = nil
#options = nil
#test_files = nil
#verbose = false
#warning = true <--------------------------
#loader = :rake
#ruby_opts = []
#description = "Run tests" + (#name == :test ? "" : " for #{#name}")
yield self if block_given?
#pattern = 'test/test*.rb' if #pattern.nil? && #test_files.nil?
define
end
You can monkey patch this to turn it off but in all honesty its probably just a good idea to leave it on and just fix your warnings. In my case I am dealing with a ton of legacy code which is only updated every so often so not really worth it.
Related
I'm trying to implement danger-swift but I don't know where I can access test results and flag failing ones from Bitrise.
I'm using a plugin for danger-swift called DangerXCodeSummary but I don't know where Bitrise stores test results from xcode-test#2.
DangerFile:
import Danger
import DangerXCodeSummary
import Foundation
let danger = Danger()
let testReportPath = "??" // What's the path for the test results?
XCodeSummary(filePath: testReportPath).report()
Bitrise script:
...
UnitTests:
before_run:
- _ensure_dependencies
after_run:
- _add_build_result_to_pr
steps:
- xcode-test#2: {} # What's the file path for the test results?
- deploy-to-bitrise-io#1: {}
envs:
- ots:
is_expand: false
BITRISE_PROJECT_PATH: MyApp.xcodeproj
- opts:
is_expand: false
BITRISE_SCHEME: AppTests
description: Unit Tests running at every commit.
...
_add_build_result_to_pr:
steps:
- script#1:
title: Commenting on the PR
is_always_run: true
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
echo "################### DANGER ######################"
echo "Install Danger"
brew install danger/tap/danger-swift
echo "Run danger"
danger-swift ci
echo "#################################################"
You can see what outputs the step generates on the Workflow Editor UI, and alternatively in the Step's repository in step.yml. For Xcode Test step specifically: https://github.com/bitrise-steplib/steps-xcode-test/blob/deb39d7e9e055a22f33550ed3110fb3c71beeb79/step.yml#L287
Am I right that you're looking for the xcresult test output? If you are, you can read it from the BITRISE_XCRESULT_PATH environment variable (https://github.com/bitrise-steplib/steps-xcode-test/blob/deb39d7e9e055a22f33550ed3110fb3c71beeb79/step.yml#L296), which is the output of Xcode Test (once Xcode Test is finished, it sets this environment variable to the xcresult's path). Keep in mind this is in .xcresult format (the official Xcode test result format).
this is my first time using tox to create a python package. I didn't underestimate this task and read myself a little bit into how setuptools and pyscaffold works, what does what and why and so on, got some yt-videos to grasp how to get it on.
But, guess what, it doesn't work, and i have absolutely no clue why.
This is what i did:
putup --tox river
then i placed my sources under src/
and some tests under tests/
so this is my folder structure so far:
river/
src/
dispatcher/
__init__.py
updater.py
river/
__init__.py
dispatcher_config.py
dispatcher.py
flow.py
logger.py
log_config.yml
tests/
__init__.py
test_cases.py
AUTHORS.rst
CHANGELOG.rst
LICENSE.txt
README.rst
setup.cfg
setup.py
tox.ini
log_config.yml
all i want to achieve for now is getting my tests running properly.
tox.ini :
[tox]
minversion = 2.4
envlist = default
[testenv]
setenv = TOXINIDIR = {toxinidir}
sitepackages = True
commands =
python --version
pytest
deps = pytest
setup.cfg - almost unchanged :
# This file is used to configure your project.
# Read more about the various options under:
# http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files
[metadata]
name = river
description = Add a short description here!
author = Kristian Jülfs
author-email = kristian.juelfs#...
license = mit
long-description = file: README.rst
long-description-content-type = text/x-rst; charset=UTF-8
url = https://github.com/pyscaffold/pyscaffold/
project-urls =
Documentation = https://pyscaffold.org/
# Change if running only on Windows, Mac or Linux (comma-separated)
platforms = any
# Add here all kinds of additional classifiers as defined under
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers =
Development Status :: 4 - Beta
Programming Language :: Python
[options]
zip_safe = False
packages = find:
include_package_data = True
package_dir =
=src
# DON'T CHANGE THE FOLLOWING LINE! IT WILL BE UPDATED BY PYSCAFFOLD!
setup_requires = pyscaffold>=3.2a0,<3.3a0
# Add here dependencies of your project (semicolon/line-separated), e.g.
# install_requires = numpy; scipy
# The usage of test_requires is discouraged, see `Dependency Management` docs
# tests_require = pytest; pytest-cov
# Require a specific Python version, e.g. Python 2.7 or >= 3.4
# python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
[options.packages.find]
where = src
exclude =
tests
[options.extras_require]
# Add here additional requirements for extra features, to install with:
# `pip install river[PDF]` like:
# PDF = ReportLab; RXP
# Add here test requirements (semicolon/line-separated)
testing =
pytest
pytest-cov
# flake8
[options.entry_points]
# Add here console scripts like:
# console_scripts =
# script_name = river.module:function
# For example:
# console_scripts =
# fibonacci = river.skeleton:run
# And any other entry points, for example:
# pyscaffold.cli =
# awesome = pyscaffoldext.awesome.extension:AwesomeExtension
[test]
# py.test options when running `python setup.py test`
#addopts = --verbose
extras = True
[aliases]
dists = bdist_wheel
[bdist_wheel]
# Use this option if your package is pure-python
universal = 1
[build_sphinx]
source_dir = docs
build_dir = build/sphinx
[devpi:upload]
# Options for the devpi: PyPI server and packaging tool
# VCS export must be deactivated since we are using setuptools-scm
no-vcs = 1
formats = bdist_wheel
[tool:pytest]
addopts = --verbose
norecursedirs =
dist
build
.tox
[flake8]
# Some sane defaults for the code style checker flake8
exclude =
.tox
build
dist
.eggs
docs/conf.py
[pyscaffold]
# PyScaffold's parameters when the project was created.
# This will be used when updating. Do not change!
version = 3.2.1
package = river
extensions =
tox
alrighti so far. Whatever i'm missing, i don't get it.
when i start tox on verbose,
tox -r -vvv
i get this (cut)
...
creating '/tmp/pip-wheel-rb7acy7z/river-0.0.post0.dev1+gc371b6b.dirty-py2.py3-none-any.whl' and adding '.' to it
adding 'dispatcher/__init__.py'
adding 'dispatcher/updater.py'
adding 'river/__init__.py'
adding 'river/dispatcher.py'
adding 'river/dispatcher_config.py'
adding 'river/flow.py'
adding 'river/logger.py'
adding 'river-0.0.post0.dev1+gc371b6b.dirty.dist-info/top_level.txt'
adding 'river-0.0.post0.dev1+gc371b6b.dirty.dist-info/WHEEL'
adding 'river-0.0.post0.dev1+gc371b6b.dirty.dist-info/METADATA'
adding 'river-0.0.post0.dev1+gc371b6b.dirty.dist-info/RECORD'
removing build/bdist.freebsd-12.0-RELEASE-p7-amd64/wheel
done
Stored in directory: /home/kjuelf/.cache/pip/wheels/f7/c7/76/923a5b579b9178351cdbe053f020f660101c03b78a4085d281
Removing source in /tmp/pip-req-build-jhc29i8z
Successfully built river
Installing collected packages: river
Successfully installed river-0.0.post0.dev1+gc371b6b.dirty
Cleaning up...
...
default start: run-test-pre
default run-test-pre: PYTHONHASHSEED='4259061550'
default finish: run-test-pre after 0.00 seconds
default start: run-test
default run-test: commands[0] | python --version
setting PATH=/usr/home/kjuelf/infra/river/.tox/default/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/kjuelf/bin
[11307] /usr/home/kjuelf/infra/river$ /usr/home/kjuelf/infra/river/.tox/default/bin/python --version
Python 3.6.9
default run-test: commands[1] | pytest
setting PATH=/usr/home/kjuelf/infra/river/.tox/default/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/kjuelf/bin
WARNING: test command found but not installed in testenv
cmd: /usr/local/bin/pytest
env: /usr/home/kjuelf/infra/river/.tox/default
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
DEPRECATION WARNING: this will be an error in tox 4 and above!
[11308] /usr/home/kjuelf/infra/river$ /usr/local/bin/pytest
============================================================ test session starts ============================================================
platform freebsd12 -- Python 3.6.9, pytest-4.5.0, py-1.8.0, pluggy-0.12.0 -- /usr/local/bin/python3.6
cachedir: .tox/default/.pytest_cache
rootdir: /usr/home/kjuelf/infra/river, inifile: setup.cfg
plugins: cov-2.7.1, flake8-1.0.4
collected 0 items / 1 errors
================================================================== ERRORS ===================================================================
___________________________________________________ ERROR collecting tests/test_cases.py ____________________________________________________
/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py:359: in get_provider
module = sys.modules[moduleOrReq]
E KeyError: 'river'
During handling of the above exception, another exception occurred:
src/river/logger.py:18: in <module>
config = resource_string("river", "log_config.yml")
/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py:1156: in resource_string
return get_provider(package_or_requirement).get_resource_string(
/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py:361: in get_provider
__import__(moduleOrReq)
E ModuleNotFoundError: No module named 'river'
...
i mean, first
Successfully built river
then
E ModuleNotFoundError: No module named 'river'
in pkg_resources/__ init __.py - KeyError: 'river'
i can't get a clue whats wrong with pkg_resources here - where is my stuff gone suddenly o_0 ??!
I also don't get what that warning means:
WARNING: test command found but not installed in testenv
it's there, pytest works, and the dependency is set in tox.ini
lost in weirdness
I am going mad on how could I make this podspec work.
I'm developing a swift framework, CommonCrypto is needed. After many problems to make it work for every for every teams (Cordova, React), this is how CommonCrypto is implemented :
I got an aggregate target CommonCryptoModuleMap with a run script in its build phase :
if [ -d "${BUILT_PRODUCTS_DIR}/CommonCryptoModuleMap" ]; then
echo "${BUILT_PRODUCTS_DIR}/CommonCryptoModuleMap directory already exists, so skipping the rest of the script."
exit 0
fi
mkdir -p "${BUILT_PRODUCTS_DIR}/CommonCryptoModuleMap"
cat <<EOF > "${BUILT_PRODUCTS_DIR}/CommonCryptoModuleMap/module.modulemap"
module CommonCrypto [system] {
header "${SDKROOT}/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
EOF
But now, the goal is to implement it as a dependence of another Framework in Swift. So I have to specified the target dependency in the podspec.
I got no problem to build or archive it from Xcode.
Here is my Podspec :
Pod::Spec.new do |s|
s.name = "AFrameworkHasNoName"
s.version = "0.1.5"
s.summary = "Foo bar"
s.homepage = "https://github.com/MyRepository_ios"
s.license = "License"
s.author = { "Veesla" => "valentin.cousien#gmail.com" }
s.source = { :git => "git#github.com:MyRepository_ios.git", :tag => "develop" }
s.swift_version = "4.0"
s.platform = :ios, "8.0"
s.requires_arc = true
s.exclude_files = "AFrameworkHasNoNameTests/*"
s.source_files = "AFrameworkHasNoName/**/*.{h,m,swift}"
s.module_name = "AFrameworkHasNoName"
end
Here is the error :
- WARN | source: The version should be included in the Git tag.
- WARN | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.
- WARN | url: The URL (https://github.com/MyRepository_ios) is not reachable.
- WARN | [iOS] license: Unable to find a license file
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- ERROR | [iOS] xcodebuild: MyFileImportingCommonCrypto.swift:10:8: error: no such module 'CommonCrypto'
Thanks for your responses
Nevermind, It seems like I'm not the only failing to include CommonCrypto in a SDK included in another SDK.
I just bypass the problem by including CryptoSwift (using only pure Swift). It works perfectly for me. It's a bit heavy but you don't have to deal with modulemap files and C library... Pretty easy to work with, nice implementation
Here the link of CryptoSwift : https://github.com/krzyzanowskim/CryptoSwift
Hope it will help one of you !
PS : can anyone explain me why did I get down voted ? :(
I have an open source scala project (https://github.com/lucidsoftware/xtract). The build on travis-ci consistently hangs while running tests, for both scala 2.11 and 2.12. Sometimes it hangs after compiling and before any output from tests, other times it hangs in the middle of running tests. I have tried several iterations of changing the travis, inclding trying with and without sudo: false, different versions of sbt, splitting up the sbt commands in different ways, using both oraclejdk8 and openjdk8, etc.
Am I doing something wrong or is this a bug?
Sample failure: https://travis-ci.org/lucidsoftware/xtract/jobs/280974227
My .travis.yml:
language: scala
scala:
- 2.11.11
- 2.12.3
jdk:
- openjdk8
dist: trusty
sudo: false
cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/
after_success:
- sbt ++$TRAVIS_SCALA_VERSION package
- |
if [ -n "$TRAVIS_TAG" ] || ([ "$TRAVIS_PULL_REQUEST" == false ] && [ "$TRAVIS_BRANCH" == master ])
then
mkdir ~/.pgp
echo $PGP_PUBLIC | base64 --decode > ~/.pgp/pubring
echo $PGP_SECRET | base64 --decode > ~/.pgp/secring
echo "Publishing snapshot"
sbt ++$TRAVIS_SCALA_VERSION xtract/publishSigned xtractTesting/publishSigned
fi
deploy:
api_key: $GITHUB_AUTH
file:
- xtract-core/target/**/*.jar
- testing/target/**/*.jar
file_glob: true
provider: releases
skip_cleanup: true
on:
tags: true
install: sbt ++$TRAVIS_SCALA_VERSION update
before_cache:
#Avoid unncessary cache updates
- find $HOME/.ivy2 -name "ivydata-*.properties" -print -delete
- find $HOME/.sbt -name "*.lock" -print -delete
EDIT
Failure with -debug option on sbt: https://travis-ci.org/lucidsoftware/xtract/jobs/281081862
The last thing it does is
[debug] Running TaskDef(com.lucidchart.open.xtract.DefaultXmlReadersSpec, specs2 Specification fingerprint, false, [SuiteSelector])
Edit 2
Some notes. This project has multiple subprojects. The build pauses while running tests, and the test are in their own project, because they depend on both the core code, and an a separate sub-project for specs2 matchers specific to the project.
It's a 10min compiler timeout. Maybe the memory limits cause too much swapping.
-Xms2048M
-Xmx2048M
-Xss6M
-XX:MaxPermSize=512M
I think I've finally figured out what was going on.
I was able to reproduce the problem in the travisci/ci-garnet:packer-1512502276-986baf0 docker container. Although to get sbt running I had to find and install the sbt-launch.jar for version 1.1.1 because the installed bootstrapper doesn't work for any version 1.0 or higher. I deleted several folders from the home folder with stuff for other languages to free disk space for downloading artifacts.
After it stalled I took a thread dump of the java process (by sending it a QUIT signal).
The output included this:
Found one Java-level deadlock:
=============================
"specs2-6":
waiting to lock monitor 0x00007fc6a4b9fb68 (object 0x00000000997e39f0, a sbt.internal.inc.classpath.ClasspathFilter),
which is held by "specs2-3"
"specs2-3":
waiting to lock monitor 0x00007fc6d0df7298 (object 0x0000000098f700b0, a sbt.internal.inc.classpath.ClasspathUtilities$$anon$1),
which is held by "specs2-6"
So I knew there was a deadlock which was preventing it from progressing.
After some googling I found a bug for mockito (https://github.com/mockito/mockito/issues/1067).
A workaround is to disable parallelExecution for tests.
I got the same issue. Add to your build.sbt
logLevel := Level.Debug
so that you can use the log-debug to check what is going in on. In my case sbt was looking for
sbt-chain: module revision found in cache: com.fasterxml.jackson#jackson-parent;2.8
[debug] tried /home/travis/.ivy2/local/com.fasterxml.jackson/jackson-bom/2.8.11/jars/jackson-bom.jar
[debug] tried https://repo1.maven.org/maven2/com/fasterxml/jackson/jackson-bom/2.8.11/jackson-bom-2.8.11.jar
[debug] CLIENT ERROR: Not Found url=https://repo1.maven.org/maven2/com/fasterxml/jackson/jackson-bom/2.8.11/jackson-bom-2.8.11.jar
[debug] tried /home/travis/.sbt/preloaded/com.fasterxml.jackson/jackson-bom/2.8.11/jars/jackson-bom.jar
[debug] tried file:////home/travis/.sbt/preloaded/com/fasterxml/jackson/jackson-bom/2.8.11/jackson-bom-2.8.11.jar
[debug] tried https://repo1.maven.org/maven2/com/fasterxml/jackson/jackson-bom/2.8.11/jackson-bom-2.8.11.jar
[debug] CLIENT ERROR: Not Found url=https://repo1.maven.org/maven2/com/fasterxml/jackson/jackson-bom/2.8.11/jackson-bom-2.8.11.jar
The MetaCPAN Travis CI coverage builds are quite slow. See https://travis-ci.org/metacpan/metacpan-web/builds/238884497 This is likely in part because we're not successfully ignoring the /local folder that gets created by Carton as part of our build. See https://coveralls.io/builds/11809290
We're using perl-helpers to help with our Travis configuration. I thought I should be able to use the DEVEL_COVER_OPTIONS environment variable in order to fix this, but I guess I don't have the correct incantation. I've included the entire config below because a few snippets out of context seemed misleading.
language: perl
perl:
- "5.22"
matrix:
fast_finish: true
allow_failures:
- env: COVERAGE=1 USE_CPANFILE_SNAPSHOT=true
- env: USE_CPANFILE_SNAPSHOT=false HARNESS_VERBOSE=1
env:
global:
# Carton --deployment only works on the same version of perl
# that the snapshot was built from.
- DEPLOYMENT_PERL_VERSION=5.22
- DEVEL_COVER_OPTIONS="-ignore ^local/"
matrix:
# Get one passing run with coverage and one passing run with Test::Vars
# checks. If run together they more than double the build time.
- COVERAGE=1 USE_CPANFILE_SNAPSHOT=true
- USE_CPANFILE_SNAPSHOT=false HARNESS_VERBOSE=1
- USE_CPANFILE_SNAPSHOT=true
before_install:
- git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers
- source ~/travis-perl-helpers/init
- npm install -g less js-beautify
# Pre-install from backpan to avoid upgrade breakage.
- cpanm -n http://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/common-sense-3.6.tar.gz
- cpanm -n App::cpm Carton
install:
- cpan-install --coverage # installs converage prereqs, if enabled
- 'cpm install `test "${USE_CPANFILE_SNAPSHOT}" = "false" && echo " --resolver metadb" || echo " --resolver snapshot"`'
before_script:
- coverage-setup
script:
# Devel::Cover isn't in the cpanfile
# but if it's installed into the global dirs this should work.
- carton exec prove -lr -j$(test-jobs) t
after_success:
- coverage-report
notifications:
email:
recipients:
- olaf#seekrit.com
on_success: change
on_failure: always
irc: "irc.perl.org#metacpan-travis"
# Use newer travis infrastructure.
sudo: false
cache:
directories:
- local
The syntax for the Devel::Cover options on the command line is weird. You need to put stuff comma-separated. At least when you use PERL5OPT.
DEVEL_COVER_OPTIONS="-ignore,^local/"
See for example https://github.com/simbabque/AWS-S3/blob/master/.travis.yml#L26, where it's a whole lot of stuff with commas.
PERL5OPT=-MDevel::Cover=-ignore,"t/",+ignore,"prove",-coverage,statement,branch,condition,path,subroutine prove -lrs t