Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15770 closed New feature (duplicate)

Models only for testing purpose?

Reported by: italo.maia@… Owned by: nobody
Component: Testing framework Version: 1.3
Severity: Normal Keywords: test models
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I was creating a django app and, when writing tests, I noticed there could be a better way to create models that should exist only in testing environment. That would make creating tests much easier.

One way to do it would be syncdb ignoring certain models marked for testing only. Example:

class MyModel(models.Model):
  ...
  class Meta:
    test_env = True  # or something else

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by mlavin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

This is a duplicate of #7835 which has a nice work-around for this issue in the comments.

comment:2 Changed 3 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.