Git Product home page Git Product logo

django-dynamic-fixtures's People

Contributors

gerbenaaltink avatar jedie avatar limedaniel avatar nezo avatar ngaranko avatar peter-slump avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-dynamic-fixtures's Issues

TypeError when running any command

I have followed the instructions here to set up a first basic fixture.

I have the following file at <myproject>/contact/fixtures/0001_create_contact.py:

from dynamic_fixtures.fixtures import BaseFixture
from contact.models import Contact

class Fixture(BaseFixture):
    def load(self):
        Contact.objects.create(first_name="Frank")

When I try to run python manage.py load_dynamic_fixtures, I receive the following error:

TypeError: expected str, bytes or os.PathLike object, not NoneType

Traceback (most recent call last):
File "<project_path>/manage.py", line 31, in
execute_from_command_line(sys.argv)
File "/Users/ME/anaconda3/envs/django/lib/python3.9/site-packages/django/core/management/init.py", line 401, in execute_from_command_line
utility.execute()
File "/Users/ME/anaconda3/envs/django/lib/python3.9/site-packages/django/core/management/init.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/ME/anaconda3/envs/django/lib/python3.9/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/ME/anaconda3/envs/django/lib/python3.9/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/Users/ME/anaconda3/envs/django/lib/python3.9/site-packages/dynamic_fixtures/management/commands/load_dynamic_fixtures.py", line 20, in handle
runner = LoadFixtureRunner()
File "/Users/ME/anaconda3/envs/django/lib/python3.9/site-packages/dynamic_fixtures/fixtures/runner.py", line 16, in init
self.loader.load_disk()
File "/Users/ME/anaconda3/envs/django/lib/python3.9/site-packages/dynamic_fixtures/fixtures/loader.py", line 31, in load_disk
self.handle_app_config(app_config=app_config)
File "/Users/ME/anaconda3/envs/django/lib/python3.9/site-packages/dynamic_fixtures/fixtures/loader.py", line 38, in handle_app_config
directory = self.get_module_directory(module_name=module_name)
File "/Users/ME/anaconda3/envs/django/lib/python3.9/site-packages/dynamic_fixtures/fixtures/loader.py", line 80, in get_module_directory
directory = os.path.dirname(module.file)
File "/Users/ME/anaconda3/envs/django/lib/python3.9/posixpath.py", line 152, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Am I doing something very obviously wrong? Could this be related to Python 3.9 at all?

command to create and fill test database...

Apply fixtures in larger projects tends to take a long time...

I have implement a django manage command that creates and apply fixtures to a persistent test database.

So i split the "create/fill test database" from the "run the tests". So the tests take less time.

Any interests to include it? I can create a pull request.

Rename project

Since Factory-boy is not a requirement for this project it should be renamed to something which fits more. Something like "django-dynamic-fixtures".

Don't raise BadFixtureError

If a app has a "fixtures" but it's not for django-dynamic-fixtures then this happens:

...
  File "/usr/local/lib/python3.5/dist-packages/dynamic_fixtures/fixtures/loader.py", line 50, in handle_app_config
    "Fixture %s in app %s has no Fixture class" % (fixture_name, app_config.label))
dynamic_fixtures.fixtures.exceptions.BadFixtureError: Fixture pages in app <Appname> has no Fixture class

So, django-dynamic-fixtures is only useable if all apps are prepared :(

What's about to only print the error messages to stderr and ignore the app?
This is IMHO better for start to use django-dynamic-fixtures in existing projects ;)

I can make a pull request for it.

Attempt to load fixtures for multiple application fails hard.

Attempting to run:

./manage.py load_dynamic_fixtures administration authext

Results in:

File "/usr/local/lib/python2.7/site-packages/dynamic_fixtures/management/commands/load_dynamic_fixtures.py", line 29, in handle
fixture_prefix=args[1])
File "/usr/local/lib/python2.7/site-packages/dynamic_fixtures/fixtures/runner.py", line 66, in get_fixture_node
"'%s'", fixture_prefix, app_label)
dynamic_fixtures.fixtures.exceptions.FixtureNotFound: ("Fixture with prefix '%s' not found in app '%s'", 'administration', 'authext')

I'll submit patch later today.

Improve error message

File "/home/peter.slump/.virtualenvs/rp/src/django-dynamic-fixtures/src/dynamic_fixtures/fixtures/loader.py", line 80, in add_dependency raise KeyError('Dependency %s not set', str(dependency)) KeyError: ('Dependency %s not set', 'some-app')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.