Closed Bug 675106 Opened 10 years ago Closed 9 years ago

Clean up lots of test support cruft that's being replicated everywhere

Categories

(Cloud Services :: Server: Core, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: telliott, Assigned: RaFromBRC)

References

Details

(Whiteboard: [qa-])

Attachments

(5 files, 4 obsolete files)

There's a lot of 

    cfg = RawConfigParser()
    cfg.read(config)

    # loading loggers
    if cfg.has_section('loggers'):
        fileConfig(_INI_FILE)

    here = {'here': os.path.dirname(os.path.realpath(config))}
    config = dict([(key, value % here)for key, value in
                   cfg.items('DEFAULT') + cfg.items('app:main')])
    config = convert_config(config)
    storage = SyncStorage.get_from_config(config, 'storage')
    auth = ServicesAuth.get_from_config(config, 'auth')

and finding root directores, etc, floating around in test supports. The code above needs to go (and if we need functionality there, we should build it into the Config object). The rest should have as much repetition as possible pulled into server-core/tests/support
Assignee: nobody → rmiller
Blocks: 676423
Attached patch server-core TestEnv refactor (obsolete) — Splinter Review
Attachment #551118 - Flags: review?(telliott)
Attachment #551118 - Flags: review?(tarek)
Attached patch server-reg using new TestEnv (obsolete) — Splinter Review
Attachment #551119 - Flags: review?(telliott)
Attachment #551119 - Flags: review?(tarek)
Attachment #551120 - Flags: review?(tarek)
Attached patch server-storage using new TestEnv (obsolete) — Splinter Review
Attachment #551121 - Flags: review?(telliott)
Attached patch account-portal using new TestEnv (obsolete) — Splinter Review
Attachment #551122 - Flags: review?(telliott)
Comment on attachment 551118 [details] [diff] [review]
server-core TestEnv refactor

I'm r+ on this as a refactoring. Looking forward to what gets built on from here.
Attachment #551118 - Flags: review?(telliott) → review+
Attachment #551118 - Flags: review?(tarek) → review+
Attachment #551119 - Flags: review?(tarek) → review+
Attachment #551120 - Flags: review?(tarek) → review+
Attachment #551118 - Attachment is obsolete: true
Attachment #553907 - Flags: review?(telliott)
Attachment #553907 - Flags: review?(tarek)
Attachment #551119 - Attachment is obsolete: true
Attachment #551119 - Flags: review?(telliott)
Attachment #553908 - Flags: review?(telliott)
Attachment #553908 - Flags: feedback?(tarek)
Attachment #551121 - Attachment is obsolete: true
Attachment #551121 - Flags: review?(telliott)
Attachment #553910 - Flags: review?(telliott)
Attachment #553910 - Flags: feedback?(tarek)
Attachment #551122 - Attachment is obsolete: true
Attachment #551122 - Flags: review?(telliott)
Attachment #553911 - Flags: review?(telliott)
Attachment #553911 - Flags: feedback?(tarek)
Attachment #553907 - Flags: review?(telliott) → review+
Comment on attachment 553908 [details] [diff] [review]
server-reg using new TestEnv

This is fine for now, but I think a goal should be to get rid of this entirely.
Attachment #553908 - Flags: review?(telliott) → review+
Attachment #553910 - Flags: review?(telliott) → review+
Comment on attachment 553911 [details] [diff] [review]
account-portal using new TestEnv

You cleaned up my flake8 protests. Boo ;)
Attachment #553911 - Flags: review?(telliott) → review+
finally got all of the components using the same config loading setup, got rid of lots of duplicate code
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Comment on attachment 553910 [details] [diff] [review]
server-storage using new TestEnv

Looks like initenv() itself could be removed -- the test could use TestEnv directly, or maybe be a base TestCase class we can inherit from.
Attachment #553910 - Flags: feedback?(tarek) → feedback+
Attachment #553908 - Flags: feedback?(tarek) → feedback+
Attachment #553907 - Flags: review?(tarek) → review+
Comment on attachment 553911 [details] [diff] [review]
account-portal using new TestEnv



Without this fix,accountportal_test.cfg was not used.

Toby maybe you want to double-check the behavior there now


>--- a/tests.ini	Wed Aug 17 10:03:42 2011 +0200
>+++ b/tests.ini	Wed Aug 17 14:33:05 2011 -0700
>@@ -1,7 +1,6 @@
> [DEFAULT]
> debug = True
> translogger = False
>-extends = etc/accountportal_test.cfg
> 
> [server:main]
> use = egg:Paste#http
>@@ -10,6 +9,7 @@
> 
> [app:main]
> use = egg:AccountPortal
>+configuration = file:%(here)s/etc/accountportal_test.cfg
> 
> # Logging configuration
> [loggers]
Attachment #553911 - Flags: feedback?(tarek) → feedback+
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.