PEP8 checker testcase in Django 1.8 project - django-testing

I'm trying to add pep8 checker testcase to my Django 1.8 project. I found this package: https://github.com/TracyWebTech/django-test-pep8
If I followed the README.md install guide except the INSTALLED_APPS part, because in my project it's a list of strings:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'test_pep8',
)
So I added it as a string without importing it in settings.py.
When I run ./manage.py test the stylecheck is not working. If I run ./manage.py test test_pep8 it works.
My assumptions are:
The problem is with this INSTALLED_APPS list, probably the tests are
not detected based on this list, because if I add a new app, I don't
need to add it here, but it's tests are running.
The structure of test_pep8 is not compatible with a Django 1.8 project (admin.py and migrations may be necessary (based on this django tutorial under python manage.py startapp polls). - I tried to add admin.py and migrations package, but I might did something wrong.
How can I make it work properly?

There is a GitHub issue for this problem here: https://github.com/TracyWebTech/django-test-pep8/issues/1
Which solves it using an additional test-file containing:
from test_pep8.tests import PEP8Test
__all__ = [
'PEP8Test',
]

Related

Build iohook from source (with electron 4.0.0 and vue)

I used vue-cli to create a vue app and then i added electron(4.0.0) via a plugin called vue-cli-plugin-electron-builder. Everything is ok and works properly.
The problem is with iohook which, as stated on their documentation, has prebuild versions for electron ABI <= 57 (in reality it's <= 64). It seems that on my project it automatically downloads and uses electron ABI(64) which is electron(3.0.0) (verified with node-abi).
electron(4.0.3/4) is ABI(69) (which is not supported). Judging by these circumstances i'm also considering that electron 4.0.0 has ABI(69) as well
iohook needs things specified in package.json [arch type, etc..] which i did specify.
iohook also wants me to npm run build but as of now it doesn't generate any build folder what so ever.
My solutions are:
Go back to electron 3.0.0
What are the differences between electron 3.0.0 and electron 4.0.x
Manually build iohook from source
Their documentation on manual building seems poor, at least for me. How do i actually do that? It's always throwing me errors / saying to cd in the lib's directory and npm run compile which doesn't work because arch type doesn't match.
As of now i want to manually build iohook.
UPDATE
I tried with electron 3.0.0 (barebones) and it's still throwing:
Error: Cannot find module 'F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\builds\electron-v64-win32-x64\build\Release\iohook.node'
at webpackEmptyContext (webpack:///./node_modules/iohook_sync?:2:10)
at eval (webpack:///./node_modules/iohook/index.js?:10:80)
at Object../node_modules/iohook/index.js (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:252:1)
at __webpack_require__ (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:20:30)
at eval (webpack:///./src/background.js?:15:16)
at Module../src/background.js (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:1395:1)
at __webpack_require__ (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:20:30)
at eval (webpack:///multi_./src/background.js?:1:18)
at Object.0 (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:1406:1)
at __webpack_require__ (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:20:30)
UPDATE 2
Doesn't work with electron 2.0.0 either...
I also added the cmake-js thing in package.json
"cmake-js": {
"runtime": "electron",
"runtimeVersion": "2.0.0"
}
Tried electron-rebuild -f -w iohook as well, didn't solve the problem either
Support for Electron v2+ is here now (try iohook version 0.4+). We are currently working on the Win32/64 support for electron 4. All other platforms are fine. You can follow the debug here : https://github.com/wilix-team/iohook/pull/157

Separate Ember Addon from vendor.js file to a separate file

I'm using a "core"-addon which contains logic that is used in multiple "boilerplate" - ember applications, when I build a boilerplate-application, the addon code is added to the "vendor.js" file found in the "assets"-folder. Is there a way I can make this code build to a separate "my-addon-vendor.js" file?
While browsing I found others with the same need, but an answer has yet to be found.
My "core"-addon is linked to my "boilerplate"-project using "npm link my-core-addon".
Thanks in advance
Versions:
Ember Version: 3.5.0
Ember CLI: 3.5.0
Node: 8.11.3
npm: 5.6.0
You could do something like this:
var qrScannerWorker = new Funnel(
'node_modules/qr-scanner/', {
include: ['qr-scanner-worker.min.js'],
destDir: '/libraries/qr-scanner/'
}
);
https://github.com/NullVoxPopuli/emberclear/blob/master/packages/frontend/ember-cli-build.js#L139
this won't work for addons, but it'll work for underlying dependencies. So, if an addon is doing the bundling for you, you may want to do it yourself.

Elm "cannot find module"

I'm fairly new in Elm. It's interesting to see a functional language which allows you to develop front-end stuff. Now even if I am following the steps described here nicely, I still have problems with modules.
The code is
module Main where
import Html exposing ( Html )
import Signal
main : Signal Html.Html
main = Html.text "This should work."
|> Signal.constant
I have used elm-reactor -a='localhost' to be able to view my output. But I am getting an error, that module 'HTML' cannot be found:
I cannot find find module 'Html'.
Module 'Main' is trying to import it.
Potential problems could be:
* Misspelled the module name
* Need to add a source directory or new dependency to elm-package.json
(note the double "find" hehe)
The fix suggestion didn't help me. Or it could be that I'm not understanding the use of the .json file correctly.
elm-package.json:
{
"version": "1.0.0",
"summary": "testing elm",
"license": "BSD3",
"source-directories": [
".",
"./bin/"
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "3.0.0 <= v < 4.0.0"
},
"elm-version": "0.16.0 <= v < 0.17.0"
}
Here is a screenshot of my file tree.
Maybe it behaves differently than how Haskell is threatening the modules.
How can I solve this - eh simple? - problem.
Or is my elm-package.json just configured incorrectly?
Update for Elm 0.17
In 0.17, the Html package has been moved to elm-lang/html. Run the following command from the terminal to install it:
elm package install elm-lang/html
You should also remove the evancz/elm-html package from elm-package.json because it no longer exists as of 0.17.
For more information about the upgrading from 0.16 to 0.17, please see the 0.17 announcement.
Original Answer for Elm 0.16
Your elm-package.json configuration is missing the evancz/elm-html package, which exposes Html. You can use elm's package manager to install dependencies rather than editing elm-package.json directly.
From the terminal, type the following:
elm package install evancz/elm-html
You will also be prompted to install a few other missing dependencies required by evancz/elm-html. Running this command will update your elm-package.json file as well as pull down the missing packages from the internet and install them in the standard elm-stuff/packages directory.
More info on the elm-package tool can be found here.
You can browse elm packages online at package.elm-lang.org. The sidebar has a Popular Packages section which contains the evancz/elm-html package mentioned here.

Installing behat on a Symfony 2.0 project using deps - what versions?

I have a legacy Symfony 2.0 project (version 2.0.11 to be precise) to which I'd like to add behat tests. As it's Symfony 2.0, it uses the deps vendor system rather than composer. I'm not in a position to upgrade the Symfony version or switch to composer at the moment.
I attempted to install behat using the following deps settings:
[Mink]
target=/Behat/Mink
git=git://github.com/Behat/Mink.git
version=v1.3.3
[MinkBundle]
target=/Behat/MinkBundle
git=git://github.com/Behat/MinkBundle.git
[BehatBundle]
target=/Behat/BehatBundle
git=git://github.com/Behat/BehatBundle.git
[Gherkin]
target=/Behat/Gherkin
git=git://github.com/Behat/Gherkin.git
version=v2.1.1
[Behat]
target=/Behat/Behat
git=git://github.com/Behat/Behat.git
version=v2.3.5
[Goutte]
target=/Goutte
git=git://github.com/fabpot/Goutte.git
(Yes, I know that the BehatBundle etc are outdated, but it looked like I'd need these outdated versions given that I'm using deps and sf2.0.)
When I run vendor/Behat/Behat/bin/behat, I then get the issue described here:
PHP Warning: require_once(behat/autoload.php): failed to open stream: No such file or directory in /home/sam/wo-code/PersonaBubble/vendor/Behat/Behat/bin/behat on line 23
PHP Fatal error: require_once(): Failed opening required 'behat/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/sam/wo-code/PersonaBubble/vendor/Behat/Behat/bin/behat on line 23
I realised that behat 2.3.5 doesn't actually have an autoload.php file. I looked through Behat's tags on Github and realised that 2.1.3 was the latest version which had an autoload.php (actually autoload.php.dist, though every earlier version also had autoload.php.dist rather than autoload.php, so I assumed that this was it).
I therefore changed my behat version number in deps to v2.1.3, deleted my vendors and re-installed. The behat command had then changed, so I ran:
php vendor/Behat/Behat/bin/behat.php
I now saw this error:
PHP Fatal error: Class 'Symfony\Component\Console\Application' not found in /home/sam/wo-code/PersonaBubble/vendor/Behat/Behat/src/Behat/Behat/Console/BehatApplication.php on line 26
Does anyone know what the correct versions of behat etc are that I should use to get it working with Symfony 2.0 and deps? Or is there some other step that I'm missing.
PS I ended up running behat via PHAR (although this had other problems so I abandoned it as not worth it). However, I really want to know how to do it via standard vendors install, hence this post.
I'm not in a position to upgrade the Symfony version or switch to
composer at the moment.
I understand what you say but example below might give you a bit of hint I hope! I hope it helps a bit.
I'm sharing what I have been using for all my Symfony2 projects. Behat+Mink+Selenium
CONPOSER:
You need certain versions so that eveyone use same versions of everthing.
mySymfonyProject/composer.json:
"require": {
"behat/behat": "2.5.*#stable",
"behat/behat-bundle": "1.0.0",
"behat/symfony2-extension": "1.1.2",
"behat/mink": "1.5.0",
"behat/mink-extension": "~1.3",
"behat/mink-selenium2-driver": "1.1.1",
"behat/mink-goutte-driver": "1.0.9"
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "dev",
BEHAT
mySymfonyProject/behat.yml:
default:
context:
class: FeatureContext
extensions:
Behat\Symfony2Extension\Extension:
mink_driver: true
kernel:
env: test
debug: true
Behat\MinkExtension\Extension:
base_url: 'http://mysymfonyproject.local/app_test.php/'
javascript_session: selenium2
browser_name: firefox
goutte: ~
selenium2: ~
paths:
features: %behat.paths.base%/src
bootstrap: %behat.paths.features%/Context
SELENIUM
Download into your project. It is here, make sure you download 2.43.1 version which is in the middle of the page.
Run it: java -jar selenium-server-standalone-2.43.1.jar
CONTEXT FEATURE
mySymfonyProject/src/Site/CommonBundle/Features/Context/FeatureContext.php
<?php
namespace Site\CommonBundle\Features\Context;
use Behat\MinkExtension\Context\MinkContext;
use Behat\Symfony2Extension\Context\KernelAwareInterface;
use Symfony\Component\HttpKernel\KernelInterface;
class FeatureContext extends MinkContext implements KernelAwareInterface
{
/**
* Hold Symfony kernel object.
*
* #var object Kernel Object.
*/
protected $kernel;
/**
* Helps to use doctrine and entity manager.
*
* #param KernelInterface $kernelInterface Interface for getting Kernel.
*/
public function setKernel(KernelInterface $kernelInterface)
{
$this->kernel = $kernelInterface;
}
//And your own methods
}
TESTS
When you have feature files you can run them like this (this runs all in one go. for more info read behat doc):
bin/behat #SiteCommonBundle

Travis-CI not being able to load tv4

My project was passing on Travis till my last commit. After this commit, Travis says:
Error: Cannot find module 'tv4' (at https://travis-ci.org/a85/Newman/builds/37216427#L141)
It has installed tv4#1.1.3 as part of the build (as seen at https://travis-ci.org/a85/Newman/builds/37216427#L40)
In version 1.1.3 of tv4, the name field in package.json is "tv4" (https://github.com/geraintluff/tv4/commit/4887d0f073951db681d23b9fde69ed7a9092fdea), so I guess it's not a case issue.
I've tried rebuilding a number of times, but it hasn't helped. Running grunt test locally works perfectly.
Any ideas?
I have the same issue, but i managed to fix this when i changed package.json to the following:
{"main": "tv4.js"}
Instead of
{"main": "tv4.min.js"}
If you take a look at:
https://github.com/geraintluff/tv4/issues/157