On maandag 23 juli 2018 17:23:20 CEST chuck.horow...@packetviper.us wrote:
> Hi Kum,
> 
> I think Melvyn's suggestion is a good one.  Is there any reason you
> couldn't do:
> 
> 
> import DEBUG from yourapp.settings
> 
> 
> And then check against that for your testing?

Here's some code I used in a test:

class KvkApiTester(Testcase):
        def skip_live_tests(self):
                api_config = getattr(settings, 'KVKAPI', dict())
                if not kvk_config or kvk_config['live_tests'] is False:
                        raise self.skipTest('live tests disabled or no KVKAPI 
configuration)

        def test_api_key(self):
                self.skip_live_tests()
                ... # actual tests

That way you know why tests are not running.

> 
> On Monday, July 23, 2018 at 8:22:17 AM UTC-4, Melvyn Sopacua wrote:
> > On maandag 23 juli 2018 13:39:27 CEST Jason wrote:
> > > you shouldn't be accessing external services with your tests
> > 
> > Non-sense. Part of interacting with a remote API is making sure it works
> > and
> > they didn't change anything (trust me, there's plenty of API's that change
> > without changing version numbers).
> > 
> > As for a global setting: no there isn't one. Your tests should have a
> > switch
> > of their own if you're worried about that.


-- 
Melvyn Sopacua


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5218345.80TMzJj1UW%40fritzbook.
For more options, visit https://groups.google.com/d/optout.

Reply via email to