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

RESOLVED FIXED

Status

Cloud Services
Server: Core
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: telliott, Assigned: RaFromBRC)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [qa-])

Attachments

(5 attachments, 4 obsolete attachments)

(Reporter)

Description

7 years ago
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
(Reporter)

Updated

7 years ago
Assignee: nobody → rmiller
(Reporter)

Updated

7 years ago
Blocks: 676423
(Assignee)

Comment 1

7 years ago
Created attachment 551118 [details] [diff] [review]
server-core TestEnv refactor
Attachment #551118 - Flags: review?(telliott)
Attachment #551118 - Flags: review?(tarek)
(Assignee)

Comment 2

7 years ago
Created attachment 551119 [details] [diff] [review]
server-reg using new TestEnv
Attachment #551119 - Flags: review?(telliott)
Attachment #551119 - Flags: review?(tarek)
(Assignee)

Comment 3

7 years ago
Created attachment 551120 [details] [diff] [review]
server-sreg use new TestEnv
Attachment #551120 - Flags: review?(tarek)
(Assignee)

Comment 4

7 years ago
Created attachment 551121 [details] [diff] [review]
server-storage using new TestEnv
Attachment #551121 - Flags: review?(telliott)
(Assignee)

Comment 5

7 years ago
Created attachment 551122 [details] [diff] [review]
account-portal using new TestEnv
Attachment #551122 - Flags: review?(telliott)
(Reporter)

Comment 6

7 years ago
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+

Updated

7 years ago
Attachment #551118 - Flags: review?(tarek) → review+

Updated

7 years ago
Attachment #551119 - Flags: review?(tarek) → review+

Updated

7 years ago
Attachment #551120 - Flags: review?(tarek) → review+
(Assignee)

Comment 7

7 years ago
Created attachment 553907 [details] [diff] [review]
server-core TestEnv refactor
Attachment #551118 - Attachment is obsolete: true
Attachment #553907 - Flags: review?(telliott)
Attachment #553907 - Flags: review?(tarek)
(Assignee)

Comment 8

7 years ago
Created attachment 553908 [details] [diff] [review]
server-reg using new TestEnv
Attachment #551119 - Attachment is obsolete: true
Attachment #551119 - Flags: review?(telliott)
Attachment #553908 - Flags: review?(telliott)
Attachment #553908 - Flags: feedback?(tarek)
(Assignee)

Comment 9

7 years ago
Created attachment 553910 [details] [diff] [review]
server-storage using new TestEnv
Attachment #551121 - Attachment is obsolete: true
Attachment #551121 - Flags: review?(telliott)
Attachment #553910 - Flags: review?(telliott)
Attachment #553910 - Flags: feedback?(tarek)
(Assignee)

Comment 10

7 years ago
Created attachment 553911 [details] [diff] [review]
account-portal using new TestEnv
Attachment #551122 - Attachment is obsolete: true
Attachment #551122 - Flags: review?(telliott)
Attachment #553911 - Flags: review?(telliott)
Attachment #553911 - Flags: feedback?(tarek)
(Reporter)

Updated

7 years ago
Attachment #553907 - Flags: review?(telliott) → review+
(Reporter)

Comment 11

7 years ago
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+
(Reporter)

Updated

7 years ago
Attachment #553910 - Flags: review?(telliott) → review+
(Reporter)

Comment 12

7 years ago
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+
(Assignee)

Comment 13

7 years ago
finally got all of the components using the same config loading setup, got rid of lots of duplicate code
Status: NEW → RESOLVED
Last Resolved: 7 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+

Updated

7 years ago
Attachment #553908 - Flags: feedback?(tarek) → feedback+

Updated

7 years ago
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.