Skip to content

Instantly share code, notes, and snippets.

(pipenv-tests) ~/Desktop/pipenv master ✗
» pipenv run pytest -n 8 tests
Loading .env environment variables…
============================= test session starts ==============================
platform darwin -- Python 3.6.4, pytest-3.4.0, py-1.5.2, pluggy-0.6.0
rootdir: /Users/sobolev/Desktop/pipenv, inifile:
plugins: xdist-1.22.0, forked-0.2
gw0 [111] / gw1 [111] / gw2 [111] / gw3 [111] / gw4 ok / gw5 ok / gw6 ok / gw7 ogw0 [111] / gw1 [111] / gw2 [111] / gw3 [111] / gw4 [111] / gw5 ok / gw6 ok / gwgw0 [111] / gw1 [111] / gw2 [111] / gw3 [111] / gw4 [111] / gw5 [111] / gw6 ok /gw0 [111] / gw1 [111] / gw2 [111] / gw3 [111] / gw4 [111] / gw5 [111] / gw6 ok /gw0 [111] / gw1 [111] / gw2 [111] / gw3 [111] / gw4 [111] / gw5 [111] / gw6 [111] / gw7 [111]
scheduling tests via LoadScheduling
FFFFFF..s........s..s......F..................F......................... [ 64%]
@sobolevn
sobolevn / Pipfile
Created November 11, 2017 09:23
mimesis-factory
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
mimesis = "*"
defmodule EctoSlugs.Blog.Article.TitleSlug do
use EctoAutoslugField.Slug, from: :title, to: :slug
def build_slug(sources, _changeset) do
sources
|> super()
|> String.replace("-", "+")
end
end
defmodule EctoSlugs.Blog.Article.TitleSlug do
use EctoAutoslugField.Slug, to: :slug
import Ecto.Changeset
def get_sources(changeset, _opts) do
# This function is used to get sources to build slug from:
base_fields = [:title]
if get_change(changeset, :breaking, false) do
defmodule EctoSlugs.Blog.Article.TitleSlug do
use EctoAutoslugField.Slug, from: :title, to: :slug
end
defmodule EctoSlugs.Repo.Migrations.CreateEctoSlugs.Blog.Article do
use Ecto.Migration
def change do
alter table(:blog_articles) do
add :slug, :string
end
create unique_index(:blog_articles, [:slug]) # should be unique
end
defmodule EctoSlugs.Blog.Article do
use Ecto.Schema
import Ecto.Changeset
alias EctoSlugs.Blog.Article
alias EctoSlugs.Blog.Article.TitleSlug
schema "blog_articles" do
field :breaking, :boolean, default: false
field :content, :string
field :title, :string
defmodule EctoSlugs.Blog.Article do
use Ecto.Schema
import Ecto.Changeset
alias EctoSlugs.Blog.Article
schema "blog_articles" do
field :breaking, :boolean, default: false
field :content, :string
field :title, :string
--- Logging error ---
Traceback (most recent call last):
File "/Users/sobolev/.virtualenvs/bre_slots_rest/lib/python3.6/site-packages/django/template/base.py", line 885, in _resolve_lookup
current = current[bit]
TypeError: list indices must be integers or slices, not str
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/sobolev/.virtualenvs/bre_slots_rest/lib/python3.6/site-packages/django/template/base.py", line 893, in _resolve_lookup
defmodule MediumPhxExample.Web.FallbackController do
@moduledoc """
Translates controller action results into valid `Plug.Conn` responses.
See `Phoenix.Controller.action_fallback/1` for more details.
"""
use MediumPhxExample.Web, :controller
def call(conn, {:error, %Ecto.Changeset{} = changeset}) do
conn