Tastypie tests fail with TransactionManagementError - tastypie

Running the django-tastypie tests fails with lots of TransactionManagementErrors.
I'm sure I'm doing something wrong here, but having trouble figuring out what it is.
I followed these directions on a cloned repository with no changes.
https://github.com/django-tastypie/django-tastypie/blob/604e4ac97046773625c99ae43dd1c1df1b4d39af/docs/index.rst#running-the-tests
How do I get the tests working?
$ tox -e py27-dj18
py27-dj18 develop-inst-nodeps: /home/aaron/django-tastypie
py27-dj18 installed: biplist==1.0.1,coverage==4.2,defusedxml==0.4.1,Django==1.8.17,django-oauth-plus==2.2.9,-e git+git#github.com:aaronelliotross/django-tastypie.git#29eae9123152cd9e96090b63916fa501b2ef37a3#egg=django_tastypie,httplib2==0.9.2,lxml==3.6.4,mock==1.0.1,oauth2==1.9.0.post1,pysqlite==2.7.0,python-dateutil==2.6.0,python-digest==1.7,python-mimeparse==1.6.0,pytz==2013b0,PyYAML==3.12,six==1.10.0
py27-dj18 runtests: PYTHONHASHSEED='1556702699'
py27-dj18 runtests: commands[0] | /home/aaron/django-tastypie/.tox/py27-dj18/bin/coverage run --append --source=tastypie,tests /home/aaron/django-tastypie/.tox/py27-dj18/bin/django-admin.py test -p * core.tests --settings=settings_core
Creating test database for alias 'default'...
..E..E..EE..............E..E.E....................................................E.EEEE................................................EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE..EEEEEE.........E..EEE.EEE.EEEEE.E.EEEEEE...........................................................E........EEEEEEEE.EEE..E.EEEE.....
======================================================================
.. snip ...
Ran 372 tests in 2.014s
FAILED (errors=155)

Related

How to setup tRPC project with pnpm

I am trying to learn from this repo.
Step 3 of the setup instructions says to run yarn dx.
The package.json for this repo defines that script as:
"dx": "run-p dx:* --print-label",
When I try to do this, I get an error message that says:
yarn dx yarn run v1.22.19 $ run-p dx:* --print-label [dx:next
] $ run-s migrate-sqlite generate-sqlite db-seed && next dev
[dx:prisma-studio] $ pnpm prisma-studio-sqlite [dx:prisma-studio]
/bin/sh: pnpm: command not found [dx:prisma-studio] error Command
failed with exit code 127. [dx:prisma-studio] info Visit
https://yarnpkg.com/en/docs/cli/run for documentation about this
command. ERROR: "dx:prisma-studio" exited with 127. error Command
failed with exit code 1.
I'm not sure what pnpm means, or why prisma is trying to link to sqlite when the db it specifies is psql.
Can anyone point me in the direction of what's required to get this repo to start?
If you use yarn, change any occurrence in the package.json from pnpm to yarn and I think it should work :)

How to fix "pytest: error: unrecognized arguments: -n"

Hi I am trying to run my tests parallely(pytest-xdist) on the azure pipelines.
Till now the tests were running perfectly fine.
Suddenly the pytest is throwing a weird error saying "unrecognized argument".
The file name : integration_test.py
Command used : pytest -n 5 --tb=short integration_test.py -v -s --> to run 5 tests parallely
Total number of tests : 57
Versions :
pytest==6.2.5
pytest-xdist==2.3.0
Even tried with the latest versions of these 2 modules.
Error :
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n integration_test.py
How can I overcome this error?
This error is what you encountered:
As hoefling mentioned, the solution is to install the pytest-xdist:
pip install pytest-xdist
On MacOS just running pytest might be ran by a different Python's version than you thought.
$ pytest
============================================================================== test session starts ===============================================================================
platform darwin -- Python 3.9.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
rootdir: [REDACTED]
plugins: anyio-3.5.0, cov-3.0.0
While
$ python3 -m pytest
============================================================================== test session starts ===============================================================================
platform darwin -- Python 3.10.6, pytest-7.1.2, pluggy-1.0.0
rootdir: [REDACTED]
plugins: xdist-2.5.0, forked-1.4.0, pylama-8.4.1
Be careful, and launch it as a module :)

AOSP Android 12 Beta version build fails

I've tried to compile AOSP android 12 beta branches with no success.
I cloned the repo using:
repo init -u https://android.googlesource.com/platform/manifest -b refs/tags/android-s-beta-3
repo sync
and then used:
source build/envsetup.sh
lunch aosp_blueline-userdebug
m
now when it starts to run, after a while, it fails because there's duplication at the stub libraries:
[ 95% 86/90] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
cd "$(dirname "out/soong/.bootstrap/bin/soong_build")" && BUILDER="$PWD/$(basename "out/soong/.bootstrap/bin/soong_build")" && cd / && env -i "$BUILDER" --top "$TOP" --out "out/soong" -n "out" -d "out/soong/build.ninja.d" -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp
error: build/soong/java/core-libraries/Android.bp:130:1: module "legacy.core.platform.api.stubs" already defined
libcore/mmodules/core_platform_api/Android.bp:182:1 <-- previous definition here
error: build/soong/java/core-libraries/Android.bp:146:1: module "stable.core.platform.api.stubs" already defined
libcore/mmodules/core_platform_api/Android.bp:198:1 <-- previous definition here
error: build/soong/java/core-libraries/Android.bp:164:1: module "legacy-core-platform-api-stubs-system-modules" already defined
libcore/mmodules/core_platform_api/Android.bp:216:1 <-- previous definition here
error: build/soong/java/core-libraries/Android.bp:180:1: module "stable-core-platform-api-stubs-system-modules" already defined
libcore/mmodules/core_platform_api/Android.bp:232:1 <-- previous definition here
error: libcore/JavaLibrary.bp:994:1: module "core.current.stubs" already defined
build/soong/java/core-libraries/Android.bp:27:1 <-- previous definition here
error: libcore/JavaLibrary.bp:1015:1: module "core-current-stubs-for-system-modules" already defined
build/soong/java/core-libraries/Android.bp:48:1 <-- previous definition here
error: libcore/JavaLibrary.bp:1041:1: module "core-current-stubs-system-modules" already defined
build/soong/java/core-libraries/Android.bp:74:1 <-- previous definition here
I've also tried to change the build/soong branch to master and I've got another build faliure.
How do I compile those beta versions? what am I missing??
Moreover, all the Android 12 betas I've tried are broken. For example, another beta 1 question
Thanks!
Ok so finally I've got this beta version compiled.
The thing I've found is that beta branch/ tag is not necessarily compiling.
So what I did is looking at:
https://android.googlesource.com/platform/
and when I ran into errors I've tried to checkout a later commit for this problematic sub-module that fixes this compilation.
Doing this until finding a combination of commits that compiled together did the magic.
If someone would like to know which specific commit I've checkout in order to get Android 12 beta 2 compiled just tell me
Actual problem is that this AOSP 12 Beta 3 is not fully synced and few of the modules were mentioned on different-2 files due to that you are getting these errors. I was also getting the same errors.
To get rid of these errors by commenting these modules in these files.
error: build/soong/java/core-libraries/Android.bp:130:1: module "legacy.core.platform.api.stubs" already defined
libcore/mmodules/core_platform_api/Android.bp:182:1 <-- previous definition here
build/soong/java/core-libraries/Android.bp line 130 you can comment this module.
/*java_library {
name: "legacy.core.platform.api.stubs",
visibility: core_platform_visibility,
hostdex: true,
compile_dex: true,
sdk_version: "none",
system_modules: "none",
static_libs: [
"art.module.public.api.stubs.module_lib",
"conscrypt.module.platform.api.stubs",
"legacy.i18n.module.platform.api.stubs",
],
patch_module: "java.base",
}*/
Same you have to do with other modules too.
https://stackoverflow.com/users/4618429/omribager Have you build AOSP 12 Beta 3 successfully if yes, please mention the process because after these fixes also I am getting other modules issue.
[100% 1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
cd "$(dirname "out/soong/.bootstrap/bin/soong_build")" && BUILDER="$PWD/$(basename "out/soong/.bootstrap/bin/soong_build")" && cd / && env -i "$BUILDER" --top "$TOP" --out "out/soong" -n "out" -d "out/soong/build.ninja.d" -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp
error: external/rust/crates/zip/Android.bp:21:1: "libzip" depends on undefined module "libflate2"
01:00:29 soong bootstrap failed with: exit status 1
failed to build some targets (01:08 (mm:ss))

Systemd service in package is restarted on upgrade

I use debhelper with python setuptools in order to build my packages.
I recently updated the compatibility level 9 to 11 in order to use the systemd timers.
From that moment every time I upgrade the package the service contained is restarted.
I tried to build with the following rules:
#! /usr/bin/make -f
#export DH_VERBOSE = 1
export PYBUILD_NAME=my_pkg
export DH_ALWAYS_EXCLUDE=CVS:.svn:.git:.vscode*
export PYBUILD_INTERPRETERS=python3
%:
dh $# --with python3 --buildsystem=pybuild
override_dh_installinit:
dh_installinit --no-stop-on-upgrade --no-restart-on-upgrade --no-restart-after-upgrade --no-start
override_dh_systemd_enable:
dh_systemd_enable --name=my_pkg
override_dh_systemd_start:
dh_systemd_start --no-stop-on-upgrade --no-restart-on-upgrade --no-restart-after-upgrade --no-start
python3 setup.py clean --all
According to the documentation those tags should do what I look for but probably there is something I'm missing:
dh_systemd_start
dh_installinit
Every time I update it the service contained is restarted.
The service is running the update itself so when is restarted the update is left uncompleted.
As expected I was looking in the wrong direction.
The correct option to use is:
dh_installsystemd
change the rule file into:
#! /usr/bin/make -f
#export DH_VERBOSE = 1
export PYBUILD_NAME=my_pkg
export DH_ALWAYS_EXCLUDE=CVS:.svn:.git:.vscode*
export PYBUILD_INTERPRETERS=python3
%:
dh $# --with python3 --buildsystem=pybuild
override_dh_systemd_enable:
dh_systemd_enable --name=my_pkg
override_dh_installsystemd:
dh_installsystemd --no-restart-after-upgrade
override_dh_systemd_start:
python3 setup.py clean --all
I hope this will help someone else in the same situation.

Viewing the cpanm error log in Bitbucket pipelines when installing a Perl module fails

I have a BitBucket Pipeline that installs a bunch of Perl modules using cpanm. One of them fails and this is the snippet I can see in the log:
Fetching http://www.cpan.org/authors/id/P/PE/PETDANCE/ack-v3.0.2.tar.gz ... OK
Configuring ack-v3.0.2 ... OK
==> Found dependencies: File::Next
--> Working on File::Next
Fetching http://www.cpan.org/authors/id/P/PE/PETDANCE/File-Next-1.16.tar.gz ... OK
Configuring File-Next-1.16 ... OK
Building and testing File-Next-1.16 ... OK
Successfully installed File-Next-1.16
! Installing App::Ack failed. See /root/.cpanm/work/1562605191.55/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'App::Ack' is not installed
! Bailing out the installation for ..
Building and testing ack-v3.0.2 ... FAIL
How could I access the build.log that was created by the installation process?
Apparently recently Bitbucket added a feature called "after-script" so I could add the following and that would print the content of the log files.
after-script:
- ls -1 /root/.cpanm/work/*/build.log | xargs cat
or maybe even this:
after-script:
- cat /root/.cpanm/work/*/build.log
and the following, I think, will only show the content of the log files if the build failed:
after-script:
- $BITBUCKET_EXIT_CODE && cat /root/.cpanm/work/*/build.log
Read more here: https://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines